projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nanosleep: simplify carrying
[pspp]
/
tests
/
test-idpriv-drop.c
diff --git
a/tests/test-idpriv-drop.c
b/tests/test-idpriv-drop.c
index 0da443fc34e90988e17c75f160a68247ca505c27..1a22ccf23e7b71894a8d9f36d8b28b1db511cab0 100644
(file)
--- a/
tests/test-idpriv-drop.c
+++ b/
tests/test-idpriv-drop.c
@@
-1,5
+1,5
@@
/* Test of dropping uid/gid privileges of the current process permanently.
/* Test of dropping uid/gid privileges of the current process permanently.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009
-2011
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-24,17
+24,7
@@
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
static void
show_uids ()
static void
show_uids ()
@@
-45,13
+35,13
@@
show_uids ()
uid_t saved;
ASSERT (getresuid (&real, &effective, &saved) >= 0);
printf ("uids: real=%d effective=%d saved=%d",
uid_t saved;
ASSERT (getresuid (&real, &effective, &saved) >= 0);
printf ("uids: real=%d effective=%d saved=%d",
- (int) real, (int) effective, (int) saved);
+
(int) real, (int) effective, (int) saved);
#elif HAVE_GETEUID
printf ("uids: real=%d effective=%d",
#elif HAVE_GETEUID
printf ("uids: real=%d effective=%d",
-
(int) getuid (), (int) geteuid
());
+
(int) getuid (), (int) geteuid
());
#elif HAVE_GETUID
printf ("uids: real=%d",
#elif HAVE_GETUID
printf ("uids: real=%d",
- (int) getuid ());
+
(int) getuid ());
#endif
}
#endif
}
@@
-64,13
+54,13
@@
show_gids ()
gid_t saved;
ASSERT (getresgid (&real, &effective, &saved) >= 0);
printf ("gids: real=%d effective=%d saved=%d",
gid_t saved;
ASSERT (getresgid (&real, &effective, &saved) >= 0);
printf ("gids: real=%d effective=%d saved=%d",
- (int) real, (int) effective, (int) saved);
+
(int) real, (int) effective, (int) saved);
#elif HAVE_GETEGID
printf ("gids: real=%d effective=%d",
#elif HAVE_GETEGID
printf ("gids: real=%d effective=%d",
-
(int) getgid (), (int) getegid
());
+
(int) getgid (), (int) getegid
());
#elif HAVE_GETGID
printf ("gids: real=%d",
#elif HAVE_GETGID
printf ("gids: real=%d",
- (int) getgid ());
+
(int) getgid ());
#endif
}
#endif
}
@@
-104,7
+94,7
@@
main (int argc, char *argv[])
{
const char *arg = argv[i];
if (strcmp (arg, "-v") == 0)
{
const char *arg = argv[i];
if (strcmp (arg, "-v") == 0)
- verbose = true;
+
verbose = true;
}
if (verbose)
}
if (verbose)
@@
-122,9
+112,9
@@
main (int argc, char *argv[])
uid_t effective;
uid_t saved;
if (getresuid (&real, &effective, &saved) < 0
uid_t effective;
uid_t saved;
if (getresuid (&real, &effective, &saved) < 0
- || real != uid
- || effective != uid
- || saved != uid)
+
|| real != uid
+
|| effective != uid
+
|| saved != uid)
abort ();
}
#else
abort ();
}
#else
@@
-143,9
+133,9
@@
main (int argc, char *argv[])
gid_t effective;
gid_t saved;
if (getresgid (&real, &effective, &saved) < 0
gid_t effective;
gid_t saved;
if (getresgid (&real, &effective, &saved) < 0
- || real != gid
- || effective != gid
- || saved != gid)
+
|| real != gid
+
|| effective != gid
+
|| saved != gid)
abort ();
}
#else
abort ();
}
#else