summaryrefslogtreecommitdiffhomepage
path: root/coreutils/du.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-12-06 15:55:23 +0000
committerMatt Kraai <kraai@debian.org>2000-12-06 15:55:23 +0000
commit92ed8a351908d60966fd9498574c9e6ace7bd5ab (patch)
treee02182bd51b722505acc3a0b571d25e147a2efca /coreutils/du.c
parentab147f608d1215a9208e6d1fe93b6532a707dae4 (diff)
Fix exit status on failure.
Diffstat (limited to 'coreutils/du.c')
-rw-r--r--coreutils/du.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/coreutils/du.c b/coreutils/du.c
index a0f1606fe..23bb141da 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -125,6 +125,7 @@ static long du(char *filename)
int du_main(int argc, char **argv)
{
+ int status = EXIT_SUCCESS;
int i;
int c;
@@ -147,12 +148,14 @@ int du_main(int argc, char **argv)
/* go through remaining args (if any) */
if (optind >= argc) {
- du(".");
+ if (du(".") == 0)
+ status = EXIT_FAILURE;
} else {
long sum;
for (i=optind; i < argc; i++) {
- sum = du(argv[i]);
+ if (du(argv[i]) == 0)
+ status = EXIT_FAILURE;
if (sum && isDirectory(argv[i], FALSE, NULL)) {
print_normal(sum, argv[i]);
}
@@ -160,10 +163,10 @@ int du_main(int argc, char **argv)
}
}
- return EXIT_SUCCESS;
+ return status;
}
-/* $Id: du.c,v 1.26 2000/12/01 02:55:13 kraai Exp $ */
+/* $Id: du.c,v 1.27 2000/12/06 15:55:23 kraai Exp $ */
/*
Local Variables:
c-file-style: "linux"