diff options
Diffstat (limited to 'bin/ln/ln.c')
-rw-r--r-- | bin/ln/ln.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 73fffa7..b9c4f3f 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -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); } } |