]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
main: Use geteuid instead of getuid
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Mon, 16 Aug 2010 20:02:16 +0000 (23:02 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Mon, 16 Aug 2010 20:02:16 +0000 (23:02 +0300)
The effective used ID is what matters, since if someone uses setuid
bit to run the binary as root, the euid will be 0 but uid might not.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
main.c

diff --git a/main.c b/main.c
index c388da647eb19cf2fcf1dc63b96035569fb83e6b..46e6861324c9337dfa23268971e0bd1850d08685 100644 (file)
--- a/main.c
+++ b/main.c
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
        struct process process_list;
        struct parse_opts opts;
 
-       if (getuid()) {
+       if (geteuid()) {
                printf("WARNING: Running without root priviledges. "
                        "Results may be inaccurate\n");
        }