From owner-cvs-all Mon Jun 11 6:58:15 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3AB9537B40C; Mon, 11 Jun 2001 06:57:55 -0700 (PDT) (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5BDvta25686; Mon, 11 Jun 2001 06:57:55 -0700 (PDT) (envelope-from bde) Message-Id: <200106111357.f5BDvta25686@freefall.freebsd.org> From: Bruce Evans Date: Mon, 11 Jun 2001 06:57:55 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/bin/cp cp.c extern.h utils.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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