Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ls If an error is encountered, exit with non-zero status.
details: https://anonhg.NetBSD.org/src/rev/a8dc160b2614
branches: trunk
changeset: 472659:a8dc160b2614
user: simonb <simonb%NetBSD.org@localhost>
date: Tue May 04 11:55:22 1999 +0000
description:
If an error is encountered, exit with non-zero status.
Based on FreeBSD fix (in 1996!), and fixes PR bin/7514 from
Jorgen Pehrson.
diffstat:
bin/ls/ls.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (51 lines):
diff -r 7c4703a3b1b5 -r a8dc160b2614 bin/ls/ls.c
--- a/bin/ls/ls.c Tue May 04 05:23:05 1999 +0000
+++ b/bin/ls/ls.c Tue May 04 11:55:22 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ls.c,v 1.36 1999/02/17 15:28:09 kleink Exp $ */
+/* $NetBSD: ls.c,v 1.37 1999/05/04 11:55:22 simonb Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-__RCSID("$NetBSD: ls.c,v 1.36 1999/02/17 15:28:09 kleink Exp $");
+__RCSID("$NetBSD: ls.c,v 1.37 1999/05/04 11:55:22 simonb Exp $");
#endif
#endif /* not lint */
@@ -85,6 +85,7 @@
long blocksize; /* block size units */
int termwidth = 80; /* default terminal width */
int sortkey = BY_NAME;
+int rval = EXIT_SUCCESS; /* exit value - set if error encountered */
/* flags */
int f_accesstime; /* use time of last access */
@@ -327,7 +328,7 @@
traverse(argc, argv, fts_options);
else
traverse(1, dotav, fts_options);
- exit(EXIT_SUCCESS);
+ exit(rval);
/* NOTREACHED */
}
@@ -370,6 +371,7 @@
case FTS_DNR:
case FTS_ERR:
warnx("%s: %s", p->fts_name, strerror(p->fts_errno));
+ rval = EXIT_FAILURE;
break;
case FTS_D:
if (p->fts_level != FTS_ROOTLEVEL &&
@@ -448,6 +450,7 @@
warnx("%s: %s",
cur->fts_name, strerror(cur->fts_errno));
cur->fts_number = NO_PRINT;
+ rval = EXIT_FAILURE;
continue;
}
Home |
Main Index |
Thread Index |
Old Index