freebsd-dev/bin/cp
Bruce Evans e1d071dbfd 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
2001-06-11 13:57:54 +00:00
..
cp.1 Make it clear that -P is the default. 2001-05-25 07:32:58 +00:00
cp.c Removed the broken code which claimed to lose the set[ug]id bits in 2001-06-11 13:57:54 +00:00
extern.h Removed the broken code which claimed to lose the set[ug]id bits in 2001-06-11 13:57:54 +00:00
Makefile
utils.c Removed the broken code which claimed to lose the set[ug]id bits in 2001-06-11 13:57:54 +00:00