Mercurial > hg > octave-shane > gnulib-hg
diff tests/test-sethostname2.c @ 16951:9009d83acea4
root-uid: new module
This is for portability to Tandem's NonStop Kernel.
* lib/root-uid.h, modules/root-uid: New files.
* lib/euidaccess.c, lib/pt_chown.c, lib/unlinkdir.c:
* lib/write-any-file.c, tests/test-sethostname2.c:
Include "root-uid.h".
* lib/euidaccess.c (euidaccess):
* lib/pt_chown.c (main):
* lib/unlinkdir.c (cannot_unlink_dir):
* lib/write-any-file.c (can_write_any_file):
* m4/mknod.m4 (gl_FUNC_MKNOD):
* tests/test-sethostname2.c (geteuid, main):
Don't assume ROOT_UID == 0.
* modules/euidaccess (Depends-on):
* modules/pt_chown (Depends-on):
* modules/sethostname-tests (Depends-on):
* modules/unlinkdir (Depends-on):
* modules/write-any-file (Depends-on):
Add root-uid.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 26 Jun 2012 16:46:25 -0700 (2012-06-26) |
parents | 8250f2777afc |
children | e542fd46ad6f |
line wrap: on
line diff
--- a/tests/test-sethostname2.c +++ b/tests/test-sethostname2.c @@ -27,6 +27,8 @@ #include <errno.h> #include <stdio.h> +#include "root-uid.h" + #include "macros.h" #define TESTHOSTNAME "gnulib-hostname" @@ -35,7 +37,7 @@ On Cygwin, geteuid() may return non-zero even for user accounts with administrator privileges, so use a dummy value as well. */ #if !HAVE_GETEUID || defined __CYGWIN__ -# define geteuid() 0 +# define geteuid() ROOT_UID #endif int @@ -50,7 +52,7 @@ consider things like CAP_SYS_ADMIN (linux) or PRIV_SYS_ADMIN (solaris), etc. systems without a working geteuid (mingw, MSVC 9) will always skip this test. */ - if (geteuid () != 0) + if (geteuid () != ROOT_UID) { fprintf (stderr, "Skipping test: insufficient permissions.\n"); return 77;