From: <ro...@us...> - 2004-01-05 20:04:42
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/setregid In directory sc8-pr-cvs1:/tmp/cvs-serv31099/testcases/kernel/syscalls/setregid Modified Files: setregid02.c Log Message: Applied patch from Erik Andersen: ================================= The current setre*id ltp tests check vs an invalid user with uid 999999. The number 999999 is greater than the value of an unsigned short, which is the type provided by both the 2.4.x and 2.6.x kernels for __kernel_uid_t (include/asm/posix_types.h). There is no guarantee whether the C library happens to be using getuid32 or just the plain old getuid syscall under the hood. With uClibc (which currently uses an unsigned short for uid_t and gid_t), supplying a uid of 999999 causes the setre*id tests to return EINVAL (since it would overflow an unsigned short) when then causes ltp to FAIL (it is expecting an EPERM). I think the attached patch should be applied. to remove assumptions about the width of a uid_t and gid_t, and should work just fine, regardless of whether a 32bit or 16 bit uid_t and gid_t are in use. ================================= Index: setregid02.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/setregid/setregid02.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- setregid02.c 27 Mar 2003 20:36:08 -0000 1.5 +++ setregid02.c 5 Jan 2004 20:04:39 -0000 1.6 @@ -79,7 +79,7 @@ gid_t users_gr_gid, root_gr_gid, bin_gr_gid; int neg_one = -1; int exp_enos[]={EPERM, 0}; -int inval_user = 999999; +int inval_user = (USHRT_MAX-2); char nobody_uid[] = "nobody"; struct passwd *ltpuser; |