logo

utils-std

Collection of commonly available Unix tools
commit: f998e53207bd10ddf7ab4c24e654608a203bb884
parent dca7a4c59fcf1263266db22dc3f1e2c4828d6110
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 30 Apr 2024 10:35:09 +0200

cmd/ln: Fix force being on by default

Diffstat:

Mcmd/ln.c2+-
Mtest-cmd/ln.t10++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/cmd/ln.c b/cmd/ln.c @@ -21,7 +21,7 @@ #include <sys/stat.h> #include <unistd.h> // getopt, symlink, link -static bool opt_s = false, force = true; +static bool opt_s = false, force = false; static int link_flags = 0; static int diff --git a/test-cmd/ln.t b/test-cmd/ln.t @@ -52,5 +52,15 @@ ./sym_enoent_ref2 $ rm -r sym_dir_noslash + $ touch force_symlink + $ ln -s foo force_symlink + ln: Error: Destination 'force_symlink' already exists + [1] + $ test -L force_symlink + [1] + $ ln -sf foo force_symlink + $ test -L force_symlink + $ rm force_symlink + $ find . .