[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ln -F
>Submitter-Id: net
>Originator: Marco Peereboom
>Organization:
net
>Confidential: no
>Synopsis: Removed undocumented -F option in ln.
>Severity: serious
>Priority: high
>Category: user
>Class: change-request
>Release:
>Environment:
System : OpenBSD 3.1
Architecture: OpenBSD.*
Machine : All
>Description:
drauku@drauku.net found an undocumented feature in ln that is potentially dangerous.
ln -F hard links directories this is dangerous during fsck (todd@) and may
cause kernel lockups (art@). I verfied that the filesystem allows it.
>How-To-Repeat:
>Fix:
--- ln.c.old Sun Jul 21 08:59:46 2002
+++ ln.c Sun Jul 21 09:11:03 2002
@@ -58,7 +58,6 @@
#include <string.h>
#include <unistd.h>
-int dirflag; /* Undocumented directory flag. */
int fflag; /* Unlink existing files. */
int hflag; /* Check new name for symlink first. */
int sflag; /* Symbolic, not hard, link. */
@@ -75,11 +74,8 @@
int ch, exitval;
char *sourcedir;
- while ((ch = getopt(argc, argv, "Ffhns")) != -1)
+ while ((ch = getopt(argc, argv, "fhns")) != -1)
switch (ch) {
- case 'F':
- dirflag = 1; /* XXX: deliberately undocumented. */
- break;
case 'f':
fflag = 1;
break;
@@ -129,11 +125,6 @@
/* If target doesn't exist, quit now. */
if (stat(target, &sb)) {
warn("%s", target);
- return (1);
- }
- /* Only symbolic links to directories, unless -F option used. */
- if (!dirflag && S_ISDIR(sb.st_mode)) {
- warnx("%s: is a directory", target);
return (1);
}
}