This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix the error check for the return value of getgroups32


Hi,

The current implemenation of getgroups() falls back to use getgroups
system call after calling getgroups(), if errno is set as ENOSYS
before calling this function, even the kernel is capable of
getgroups32 system call.

If getgroups() succeed, the return value of getgroups32 becomes the
number of GIDs.  If getgroups() failed, the return value is -1 and
errno is set.  The current implementation uses the condition code of
getgroups32 as (result == 0), so if the return value of getgroups32 is
not 0 and errno was set ENOSYS then __libc_missing_32bit_uids is set
as 1, even the system call is succeeded.

This patch fixes the error check code for the return value of
getgroups32 in sysdeps/unix/sysv/linux/i386/getgroups.c.

Regards,
-- gotom

2003-03-26  GOTO Masanori  <gotom at debian dot or dot jp>

	* sysdeps/unix/sysv/linux/i386/getgroups.c: Fix the error
	condition check for the return value of getgroups32.


--- sysdeps/unix/sysv/linux/i386/getgroups.c	2001-07-06 13:56:16.000000000 +0900
+++ sysdeps/unix/sysv/linux/i386/getgroups.c.new2	2003-03-26 01:17:44.000000000 +0900
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -36,7 +36,7 @@
 # if __ASSUME_32BITUIDS == 0
 /* This variable is shared with all files that need to check for 32bit
    uids.  */
-extern int __libc_missing_32bit_uids;
+extern int __libc_missing_32bit_uids attribute_hidden;
 # endif
 #endif /* __NR_getgroups32 */
 
@@ -64,7 +64,7 @@
 	  int saved_errno = errno;
 
 	  result = INLINE_SYSCALL (getgroups32, 2, n, CHECK_N (groups, n));
-	  if (result == 0 || errno != ENOSYS)
+	  if (result != -1 || errno != ENOSYS)
 	    return result;
 
 	  __set_errno (saved_errno);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]