bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] [PATCH] tar: don't assume root is uid 0


From: Paul Eggert
Subject: [Bug-tar] [PATCH] tar: don't assume root is uid 0
Date: Tue, 26 Jun 2012 17:16:55 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

(I pushed this into tar's master copy.)

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 |    1 +
 src/extract.c  |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/gnulib.modules b/gnulib.modules
index 43c9de1..9e7a05a 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -45,6 +45,7 @@ quote
 quotearg
 readlinkat
 renameat
+root-uid
 rpmatch
 safe-read
 savedir
diff --git a/src/extract.c b/src/extract.c
index 0e499e5..e35c8f6 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -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;
 
-- 
1.7.6.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]