xf86Init.c contains this code to print the current OS rev in the Xorg.0.log: if (uname(&name) == 0) { ErrorF("Current Operating System: %s %s %s %s %s\n", name.sysname, name.nodename, name.release, name.version, name.machine); } This line never appears in the log on Solaris - investigation shows that uname is returning 1. While the Linux & FreeBSD man pages indicate that 0 indicates success, and a negative number is an error, other systems only state that non-negative is success and negative is an error. (This includes the Solaris, Irix, & HP-UX man pages and the uname entry in the SUSv3 spec.) This should therefore be changed to >= 0 for compatibility with these other OS'es while maintaining BSD compatibility.
Checking to see if there's any other uname calls in the tree that should be fixed at the same time, and then will fix.
There's a couple places to fix this for now: ./lib/Xmu/CvtStdSel.c: if (uname (&utss) == 0) { ./programs/Xserver/hw/xfree86/common/xf86Init.c: if (uname(&name) == 0) { ./programs/Xserver/hw/xfree86/os-support/bus/Sbus.c: if ((uname(&buffer) == 0) There's a bunch of other uname calls found which don't have this problem: - Already do the check right: ./config/imake/imake.c: if (uname(&uts_name) < 0) ./lib/X11/ConnDis.c: if (!pprotocol && phostname && uname(&sys) >= 0 && ./lib/xtrans/Xtranslcl.c: if (uname (&name) >= 0 && strcmp (host, - Check for 0, but only on platforms that specify 0 for correct returns: ./config/imake/imake.c: if (uname(&uts) != 0) [inside #ifdef NetBSD] ./programs/Xserver/hw/darwin/darwin.c: if (uname(&name) == 0) { - Don't check results at all (probably should, but uname failures should be rare, so I'm not fixing right now, will leave that to someone else): ./lib/FS/FSlibInt.c: uname(&name); ./lib/X11/XlibInt.c: uname (&name); ./lib/Xmu/GetHost.c: uname (&name); ./lib/Xt/Initialize.c: uname (&name); ./lib/dps/cslibint.c: uname (&name); ./lib/xtrans/Xtrans.c: uname (&name); ./programs/Xserver/hw/dmx/dmxinit.c: uname(&u); ./programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c: uname (&uts); ./programs/Xserver/os/access.c: uname(&name); ./programs/lbxproxy/di/wire.c: uname (&name); ./programs/xdm/auth.c: uname(&name); ./programs/xrx/rx/XUrls.c: uname(&host);
Created attachment 1587 [details] [review] Patch to fix uname return value checks
Committed to CVS HEAD: CVSROOT: /cvs/xorg Module name: xc Changes by: alanc@gabe.freedesktop.org 04/12/22 00:28:17 Log message: 2004-12-22 Alan Coopersmith <alan.coopersmith@sun.com> * xc/programs/Xserver/hw/xfree86/common/xf86Init.c: * xc/lib/Xmu/CvtStdSel.c: * xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c: Bug #2123 <https://bugs.freedesktop.org/show_bug.cgi?id=2123> Attachment #1587 [details] <https://bugs.freedesktop.org/attachment.cgi?id=1587> Call to uname should not check for return == 0, but for >= 0 instead Modified files: ./: ChangeLog xc/programs/Xserver/hw/xfree86/common/: xf86Init.c xc/lib/Xmu/: CvtStdSel.c xc/programs/Xserver/hw/xfree86/os-support/bus/: Sbus.c Revision Changes Path 1.624 +10 -1 xc/ChangeLog 1.16 +5 -1 xc/programs/Xserver/hw/xfree86/common/xf86Init.c 1.3 +1 -1 xc/lib/Xmu/CvtStdSel.c 1.3 +1 -1 xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.