diff options
author | G.raud Meyer | 2018-03-24 23:53:21 +0100 |
---|---|---|
committer | G.raud Meyer | 2018-03-27 14:48:00 +0200 |
commit | 5bb927006fca412d4beaf9fb5e225e9d5444ac3a (patch) | |
tree | 680f40046947a20d5935b0ac46974950eee01037 /misc-utils/rename.c | |
parent | docs: add to column(1) TODO (diff) | |
download | kernel-qcow2-util-linux-5bb927006fca412d4beaf9fb5e225e9d5444ac3a.tar.gz kernel-qcow2-util-linux-5bb927006fca412d4beaf9fb5e225e9d5444ac3a.tar.xz kernel-qcow2-util-linux-5bb927006fca412d4beaf9fb5e225e9d5444ac3a.zip |
rename: fix/reverse the semantics of --no-overwrite in --symlink mode
The previous behaviour was to overwrite a symlink only when the new
destination did not exist, i.e. to avoid creating a symlink to an
existing file! It had not been documented and it seems
counter-intuitive to me. So the new behavior protects symlinks pointing
to existing targets from being changed.
Also update manpage to document this mode.
Diffstat (limited to 'misc-utils/rename.c')
-rw-r--r-- | misc-utils/rename.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/misc-utils/rename.c b/misc-utils/rename.c index cbda638e1..ba71174e6 100644 --- a/misc-utils/rename.c +++ b/misc-utils/rename.c @@ -77,9 +77,9 @@ static int do_symlink(char *from, char *to, char *s, int verbose, int noact, int if (string_replace(from, to, target, target, &newname)) ret = 0; - if (ret == 1 && nooverwrite && lstat(newname, &sb) == 0) { + if (ret == 1 && nooverwrite && lstat(target, &sb) == 0) { if (verbose) - printf(_("Skipping existing link: `%s'\n"), newname); + printf(_("Skipping existing link: `%s'\n"), target); ret = 0; } |