Nuke the undocumented -F flag, since it doesn't do anything anymore.

It used to allow root to hard-link directories (and screw up programs that
expexted the ".." entry to point to the parent dir)
This commit is contained in:
peter 1996-05-24 20:36:16 +00:00
parent 983539e216
commit 1257227edf

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ln.c,v 1.4 1994/09/24 02:55:48 davidg Exp $
* $Id: ln.c,v 1.5 1994/12/06 18:50:44 bde Exp $
*/
#ifndef lint
@ -53,7 +53,6 @@ static char sccsid[] = "@(#)ln.c 8.2 (Berkeley) 3/31/94";
#include <string.h>
#include <unistd.h>
int dirflag; /* Undocumented directory flag. */
int fflag; /* Unlink existing files. */
int sflag; /* Symbolic, not hard, link. */
/* System link call. */
@ -72,11 +71,8 @@ main(argc, argv)
int ch, exitval;
char *sourcedir;
while ((ch = getopt(argc, argv, "Ffs")) != EOF)
while ((ch = getopt(argc, argv, "fs")) != EOF)
switch (ch) {
case 'F':
dirflag = 1; /* XXX: deliberately undocumented. */
break;
case 'f':
fflag = 1;
break;
@ -127,9 +123,10 @@ linkit(target, source, isdir)
warn("%s", target);
return (1);
}
/* Only symbolic links to directories, unless -F option used. */
if (!dirflag && (sb.st_mode & S_IFMT) == S_IFDIR) {
warnx("%s: is a directory", target);
/* Only symbolic links to directories. */
if (S_ISDIR(sb.st_mode)) {
errno = EISDIR;
warn("%s", target);
return (1);
}
}