summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-08-07 19:45:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-08-07 19:45:07 +0000
commit67c3a5d239cdfe9a8ec59aef95403b8a59497ab6 (patch)
treefab8875945880b4caff6dc77278cc6fc71f1ce34
parent7e63fe0af7b865f14b336ae79c80fc0910410efb (diff)
fix exit code; problem reported by jsh@sun470.rd.qms.com; fix from freebsd
-rw-r--r--bin/ls/ls.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 4eeb1a612f5..b2459346374 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ls.c,v 1.8 1997/09/18 07:58:41 deraadt Exp $ */
+/* $OpenBSD: ls.c,v 1.9 1998/08/07 19:45:06 deraadt Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-static char rcsid[] = "$OpenBSD: ls.c,v 1.8 1997/09/18 07:58:41 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ls.c,v 1.9 1998/08/07 19:45:06 deraadt Exp $";
#endif
#endif /* not lint */
@@ -107,6 +107,8 @@ int f_dirname; /* if precede with directory name */
int f_type; /* add type character for non-regular files */
int f_whiteout; /* show whiteout entries */
+int rval;
+
int
main(argc, argv)
int argc;
@@ -310,7 +312,7 @@ main(argc, argv)
traverse(argc, argv, fts_options);
else
traverse(1, dotav, fts_options);
- exit(0);
+ exit(rval);
}
static int output; /* If anything output. */
@@ -352,6 +354,7 @@ traverse(argc, argv, options)
case FTS_DNR:
case FTS_ERR:
warnx("%s: %s", p->fts_name, strerror(p->fts_errno));
+ rval = 1;
break;
case FTS_D:
if (p->fts_level != FTS_ROOTLEVEL &&
@@ -423,6 +426,7 @@ display(p, list)
warnx("%s: %s",
cur->fts_name, strerror(cur->fts_errno));
cur->fts_number = NO_PRINT;
+ rval = 1;
continue;
}