From 5f8a4bf5ab28d162b4d59738aca0f347c6a5f4ba Mon Sep 17 00:00:00 2001 From: bde Date: Mon, 11 Jun 2001 13:57:54 +0000 Subject: Removed the broken code which claimed to lose the set[ug]id bits in the !(pflag && setfile()) case for regular files unless the copy is owned by the same user and group. These bits have already been lost (or never gained) in the correct way. The code didn't actually lose the bits; it depended on them being lost already (apparently in all cases) and attempted to gain them as necessary, but it often gained them (and sometimes collateral bits) when wrong: - pflag && setfile() == 0 case (i.e., for a successful cp -p): setfile() copies all the attributes as correctly as possible (as specified by POSIX), and we sometimes messed up the up the mode by setting it again. Also, if the file is immutable, then setting the mode again gave spurious errors (PR 20646). - !pflag case. If the target is created, POSIX requires it to not have the set[ug]id bits, but we sometimes copied them from the source. If the target already exists, POSIX requires its mode to be unchanged, but we sometimes copied the whole mode from the source. PR: 20646 MFC after: 4 weeks --- bin/cp/extern.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bin/cp/extern.h') diff --git a/bin/cp/extern.h b/bin/cp/extern.h index 3b0ecef..4e5f07c 100644 --- a/bin/cp/extern.h +++ b/bin/cp/extern.h @@ -41,8 +41,7 @@ typedef struct { } PATH_T; extern PATH_T to; -extern uid_t myuid; -extern int iflag, pflag, fflag, vflag, myumask; +extern int iflag, pflag, fflag, vflag; #include -- cgit v1.1