From 6229654741554561952c6106f75681e4382cc890 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Tue, 19 Feb 2013 11:36:57 +0000 Subject: 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. --- src/copy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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 } -- cgit v1.2.3-54-g00ecf