From 3035739e5b7d5a9042292d64455feb4b38788fe4 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 22 Dec 2004 08:28:16 +0000 Subject: [PATCH] Bug #2123 Attachment #1587 Call to uname should not check for return == 0, but for >= 0 instead --- hw/xfree86/common/xf86Init.c | 6 +++++- hw/xfree86/os-support/bus/Sbus.c | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index e167781a3..2a251e4f6 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1765,7 +1765,11 @@ xf86PrintBanner() { struct utsname name; - if (uname(&name) == 0) { + /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX, + and Irix) and Single Unix Spec 3 just say that non-negative is success. + All agree that failure is represented by a negative number. + */ + if (uname(&name) >= 0) { ErrorF("Current Operating System: %s %s %s %s %s\n", name.sysname, name.nodename, name.release, name.version, name.machine); } diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c index 4be660a75..efe5c4ba6 100644 --- a/hw/xfree86/os-support/bus/Sbus.c +++ b/hw/xfree86/os-support/bus/Sbus.c @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.3 2003/06/10 20:48:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.2tsi Exp $ */ #include #include @@ -166,10 +166,12 @@ promIsP1275(void) #elif defined(sun) struct utsname buffer; - if ((uname(&buffer) == 0) && !strcmp(buffer.machine, "sun4u")) + if ((uname(&buffer) >= 0) && !strcmp(buffer.machine, "sun4u")) promP1275 = TRUE; else promP1275 = FALSE; +#elif defined(__FreeBSD__) + promP1275 = TRUE; #else #error Missing promIsP1275() function for this OS #endif