summaryrefslogtreecommitdiffstats
path: root/misc-utils/script.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:53 +0100
committerKarel Zak2006-12-07 00:25:53 +0100
commitffc4374869b9ac10539a3c18e13b29d1b0c64484 (patch)
tree1b8054e83f7f70e8fa77499fc9246d1cc16faa15 /misc-utils/script.c
parentImported from util-linux-2.11n tarball. (diff)
downloadkernel-qcow2-util-linux-ffc4374869b9ac10539a3c18e13b29d1b0c64484.tar.gz
kernel-qcow2-util-linux-ffc4374869b9ac10539a3c18e13b29d1b0c64484.tar.xz
kernel-qcow2-util-linux-ffc4374869b9ac10539a3c18e13b29d1b0c64484.zip
Imported from util-linux-2.11o tarball.
Diffstat (limited to 'misc-utils/script.c')
-rw-r--r--misc-utils/script.c10
1 files changed, 5 insertions, 5 deletions
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);