Date: Mon, 11 Jun 2001 06:57:55 -0700 (PDT) From: Bruce Evans <bde@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/bin/cp cp.c extern.h utils.c Message-ID: <200106111357.f5BDvta25686@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
bde 2001/06/11 06:57:55 PDT Modified files: bin/cp cp.c extern.h utils.c Log: 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 Revision Changes Path 1.26 +1 -9 src/bin/cp/cp.c 1.11 +2 -3 src/bin/cp/extern.h 1.30 +4 -18 src/bin/cp/utils.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106111357.f5BDvta25686>