Page MenuHomeFreeBSD

D11167.id29526.diff
No OneTemporary

D11167.id29526.diff

Index: bin/ln/ln.c
===================================================================
--- bin/ln/ln.c
+++ bin/ln/ln.c
@@ -246,10 +246,12 @@
/*
* If the target is a directory (and not a symlink if hflag),
* append the source's name.
+ * If Fflag is set, we skip the next block to prevent
+ * updating the original target so that it gets unlinked.
*/
- if (isdir ||
+ if (!Fflag && (isdir ||
(lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) ||
- (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) {
+ (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode)))) {
if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) ||
(p = basename(bbuf)) == NULL ||
snprintf(path, sizeof(path), "%s/%s", target, p) >=
Index: bin/ln/tests/ln_test.sh
===================================================================
--- bin/ln/tests/ln_test.sh
+++ bin/ln/tests/ln_test.sh
@@ -160,10 +160,10 @@
sF_flag_body()
{
- atf_expect_fail "B isn't being unlinked (bug 219943)"
atf_check mkdir A B
atf_check ln -sF A B
atf_check -o inline:'Symbolic Link\n' stat -f %SHT B
+ atf_check -o inline:'A\n' readlink B
}
atf_test_case sf_flag

File Metadata

Mime Type
text/plain
Expires
Mon, Aug 17, 9:36 PM (12 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36875131
Default Alt Text
D11167.id29526.diff (1 KB)

Event Timeline