]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(DO_CHOWN): Do not make a special case for non-root.
authorJim Meyering <jim@meyering.net>
Fri, 18 Aug 2000 07:08:04 +0000 (07:08 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 18 Aug 2000 07:08:04 +0000 (07:08 +0000)
POSIX.2 requires that cp -p and mv attempt to set the uid of the
destination file, even if you're not root.  This affects behavior
only on hosts that let you give files away via chmod.

src/copy.c

index ef3ab174ff421da85eb484ef08419b1b5f4ac596..207e19c194685ad9d7c398b9e9f155e6d4446761 100644 (file)
 #include "same.h"
 
 #define DO_CHOWN(Chown, File, New_uid, New_gid)                                \
-  (Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
+  (Chown (File, New_uid, New_gid)                                      \
    /* If non-root uses -p, it's ok if we can't preserve ownership.     \
       But root probably wants to know, e.g. if NFS disallows it,       \
-      or if the target system doesn't support file ownership. */       \
+      or if the target system doesn't support file ownership.  */      \
    && ((errno != EPERM && errno != EINVAL) || x->myeuid == 0))
 
 struct dir_list