From ffc4374869b9ac10539a3c18e13b29d1b0c64484 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:53 +0100 Subject: Imported from util-linux-2.11o tarball. --- misc-utils/script.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'misc-utils/script.c') diff --git a/misc-utils/script.c b/misc-utils/script.c index 973e80aa6..a5d0c6637 100644 --- a/misc-utils/script.c +++ b/misc-utils/script.c @@ -98,12 +98,12 @@ int tflg = 0; static char *progname; static void -die_if_symlink(char *fn) { +die_if_link(char *fn) { struct stat s; - if (lstat(fn, &s) == 0 && S_ISLNK(s.st_mode)) { + if (lstat(fn, &s) == 0 && (S_ISLNK(s.st_mode) || s.st_nlink > 1)) { fprintf(stderr, - _("Warning: `%s' is a symlink.\n" + _("Warning: `%s' is a link.\n" "Use `%s [options] %s' if you really " "want to use it.\n" "Script not started.\n"), @@ -135,7 +135,7 @@ main(int argc, char **argv) { } } - while ((ch = getopt(argc, argv, "afqt")) != EOF) + while ((ch = getopt(argc, argv, "afqt")) != -1) switch((char)ch) { case 'a': aflg++; @@ -162,7 +162,7 @@ main(int argc, char **argv) { fname = argv[0]; else { fname = "typescript"; - die_if_symlink(fname); + die_if_link(fname); } if ((fscript = fopen(fname, aflg ? "a" : "w")) == NULL) { perror(fname); -- cgit v1.2.3-55-g7522