Hi,

This patch removes the undocumented ln flag -F, which forces the
creation of a hard link for a directory.

This option was present since before the first revision of NetBSD CVS,
21 years ago: http://cvsweb.netbsd.org/bsdweb.cgi/src/bin/ln/ln.c
I don't know where to dig for a more precise appearance date.

The problem is this option doesn't even work, the call to linkat(2)
fails with EPERM. It's already removed in NetBSD and DragonFly. FreeBSD
has an option with a similar name but a different meaning.
Index: ln.c
===================================================================
RCS file: /home/tleguern/proj/perso/cvs/src/bin/ln/ln.c,v
retrieving revision 1.19
diff -u -p -r1.19 ln.c
--- ln.c	12 Mar 2013 06:00:05 -0000	1.19
+++ ln.c	5 May 2014 11:23:56 -0000
@@ -42,7 +42,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	Pflag;				/* Hard link to symlink. */
@@ -58,11 +57,8 @@ main(int argc, char *argv[])
 	int ch, exitval;
 	char *sourcedir;
 
-	while ((ch = getopt(argc, argv, "FfhLnPs")) != -1)
+	while ((ch = getopt(argc, argv, "fhLnPs")) != -1)
 		switch (ch) {
-		case 'F':
-			dirflag = 1;	/* XXX: deliberately undocumented. */
-			break;
 		case 'f':
 			fflag = 1;
 			break;
@@ -126,8 +122,8 @@ linkit(char *target, char *source, int i
 			warn("%s", target);
 			return (1);
 		}
-		/* Only symbolic links to directories, unless -F option used. */
-		if (!dirflag && S_ISDIR(sb.st_mode)) {
+		/* Only symbolic links to directories. */
+		if (S_ISDIR(sb.st_mode)) {
 			errno = EISDIR;
 			warn("%s", target);
 			return (1);

Reply via email to