From 89ad63ad2d77437b9ee4b21cb80c5f0552388adf Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Wed, 10 Aug 2016 18:19:08 +0000 Subject: [PATCH] Fix -S with -l not being atomic. It was unlinking the target even though it uses rename(2) which already effectively does that. -S is intended to not unlink(2) the target first. MFC after: 1 week Reviewed by: jhb Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7452 --- usr.bin/xinstall/xinstall.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 0fc394d8d21e..dec555848a6c 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -536,7 +536,6 @@ do_link(const char *from_name, const char *to_name, if (verbose) printf("install: link %s -> %s\n", from_name, to_name); - unlink(to_name); ret = rename(tmpl, to_name); /* * If rename has posix semantics, then the temporary @@ -580,8 +579,6 @@ do_symlink(const char *from_name, const char *to_name, if (target_sb->st_flags & NOCHANGEBITS) (void)chflags(to_name, target_sb->st_flags & ~NOCHANGEBITS); - unlink(to_name); - if (verbose) printf("install: symlink %s -> %s\n", from_name, to_name);