]> Dogcows Code - chaz/tar/commitdiff
tar: don't assume root is uid 0
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Jun 2012 00:14:45 +0000 (17:14 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Jun 2012 00:15:21 +0000 (17:15 -0700)
This is not true for Tandem NonStop Kernel.  See Joachim Schmitz's
comment in <http://bugs.gnu.org/10305#111>.
* gnulib.modules: Add root-uid.
* src/extract.c: Include <root-uid.h>.
(extr_init): Don't assume root is uid 0.

gnulib.modules
src/extract.c

index 43c9de16d48f8fe15883505666e11f597bef9dad..9e7a05a52c88161a9dd19d158d3eeb63252e1053 100644 (file)
@@ -45,6 +45,7 @@ quote
 quotearg
 readlinkat
 renameat
+root-uid
 rpmatch
 safe-read
 savedir
index 0e499e5d4121649cc3c468ecb4d9aeda3aba811b..e35c8f64d4cff763397aec98abedef3c2ee61ea6 100644 (file)
@@ -23,6 +23,7 @@
 #include <quotearg.h>
 #include <errno.h>
 #include <priv-set.h>
+#include <root-uid.h>
 #include <utimens.h>
 
 #include "common.h"
@@ -153,7 +154,7 @@ struct string_list
 void
 extr_init (void)
 {
-  we_are_root = geteuid () == 0;
+  we_are_root = geteuid () == ROOT_UID;
   same_permissions_option += we_are_root;
   same_owner_option += we_are_root;
 
This page took 0.030169 seconds and 4 git commands to generate.