Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F166730458
D11167.id29517.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D11167.id29517.diff
View Options
Index: bin/ln/ln.c
===================================================================
--- bin/ln/ln.c
+++ bin/ln/ln.c
@@ -228,6 +228,7 @@
char path[PATH_MAX];
char wbuf[PATH_MAX];
char bbuf[PATH_MAX];
+ char target_dir[PATH_MAX];
if (!sflag) {
/* If source doesn't exist, quit now. */
@@ -258,6 +259,8 @@
warn("%s", source);
return (1);
}
+ /* Save the original target in target_dir */
+ snprintf(target_dir, sizeof(target_dir), "%s", target);
target = path;
}
@@ -290,7 +293,7 @@
/*
* If the file exists, first check it is not the same directory entry.
*/
- exists = !lstat(target, &sb);
+ exists = !lstat(target, &sb) || !lstat(target_dir, &sb);
if (exists) {
if (!sflag && samedirent(source, target)) {
warnx("%s and %s are the same directory entry",
@@ -302,6 +305,9 @@
* Then unlink it forcibly if -f was specified
* and interactively if -i was specified.
*/
+ if (Fflag)
+ target = target_dir;
+
if (fflag && exists) {
if (Fflag && S_ISDIR(sb.st_mode)) {
if (rmdir(target)) {
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 16, 9:53 PM (5 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36843012
Default Alt Text
D11167.id29517.diff (1 KB)
Attached To
Mode
D11167: Fix behavior for '-F' option of ln(1)
Attached
Detach File
Event Timeline
Log In to Comment