summaryrefslogtreecommitdiff
path: root/src/copy.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-06-15 22:47:16 +0200
committerJim Meyering <jim@meyering.net>2007-06-15 22:47:16 +0200
commitcdec7e6e93db547a80525c24167345a090a00273 (patch)
treeca98ab8f400d602f30f1642fb1ff8b57c9713b25 /src/copy.h
parentcad884a24545464cb42296834a8b5c02ee116379 (diff)
downloadcoreutils-cdec7e6e93db547a80525c24167345a090a00273.tar.xz
Correct cp's handling of destination symlinks in some cases.
* NEWS: "cp" no longer considers a destination symlink to be the same as the referenced file when copying links or making backups. * src/copy.c (copy_reg): When following a symlink, use the followed name in later chown etc. requests, so that the created file is affected, rather than the symlink. Use O_NOFOLLOW on source when not dereferencing symlinks; this avoids a race. Preserve errno correctly when doing multiple open attempts on the destination. (copy_internal): Follow destination symlinks only when copying a regular file and only when we don't intend to remove or rename the destination first, regardless of whether following source symlinks; this is because since POSIX and tradition (e.g., FreeBSD) say we should ordinarily follow destination symlinks if the system calls would ordinarily do so. * src/copy.h (struct cp_options): Add comment that 'dereference' is only for source files. * src/cp.c (usage): Note that --derereference etc. are only for source files. (make_dir_parents_private): Follow symlinks, regardless of whether --dereference is specified, because these are destination symlinks. * tests/cp/same-file: Adjust tests to match revised behavior. Filter out perror output since it might vary from host to host. Use sed alone instead of also using echo. * doc/coreutils.texi (cp invocation): Document the behavior better when the destination is a symlink. Clarify source versus destination symlinks. Describe the new behavior for destination symlinks. 2007-06-15 Jim Meyering <jim@meyering.net> * src/copy.c: Include "canonicalize.h". (copy_reg): Use canonicalize_filename_mode to follow the symlink, so that we can always open with O_EXCL and avoid a race.
Diffstat (limited to 'src/copy.h')
-rw-r--r--src/copy.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/copy.h b/src/copy.h
index 0d6233f95..23cde2bee 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -87,7 +87,7 @@ struct cp_options
them, symbolic links,) as if they were regular files. */
bool copy_as_regular;
- /* How to handle symlinks. */
+ /* How to handle symlinks in the source. */
enum Dereference_symlink dereference;
/* If true, remove each existing destination nondirectory before