summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoachim Schmitz <jojo@schmitz-digital.de>2013-02-19 11:36:57 +0000
committerPádraig Brady <P@draigBrady.com>2013-02-20 04:05:30 +0000
commit6229654741554561952c6106f75681e4382cc890 (patch)
treecbf52b10944b494cda83258a84bd0a931ead7d18 /src
parent31861f663a440df498bdb7788fa43aa9d03133c5 (diff)
downloadcoreutils-6229654741554561952c6106f75681e4382cc890.tar.xz
copy: ensure the correct root ID is checked on all platforms
* src/copy.c (copy_reg): Check ROOT_UID rather than 0, which is significant on HP-NonStop.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c
index 244313ee7..5c0ee1e70 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -51,6 +51,7 @@
#include "ignore-value.h"
#include "ioblksize.h"
#include "quote.h"
+#include "root-uid.h"
#include "same.h"
#include "savedir.h"
#include "stat-size.h"
@@ -1127,7 +1128,7 @@ preserve_metadata:
{
bool access_changed = false;
- if (!(sb.st_mode & S_IWUSR) && geteuid () != 0)
+ if (!(sb.st_mode & S_IWUSR) && geteuid () != ROOT_UID)
access_changed = fchmod_or_lchmod (dest_desc, dst_name, 0600) == 0;
if (!copy_attr (src_name, source_desc, dst_name, dest_desc, x)
@@ -2718,7 +2719,7 @@ cp_options_default (struct cp_options *x)
priv_freeset (pset);
}
#else
- x->chown_privileges = x->owner_privileges = (geteuid () == 0);
+ x->chown_privileges = x->owner_privileges = (geteuid () == ROOT_UID);
#endif
}