summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-06-30 17:54:20 +0000
committerEric Andersen <andersen@codepoet.org>2001-06-30 17:54:20 +0000
commit8fa1bf7cd6fefc5ac3fb13eb85569d874e84f88e (patch)
tree43429320725f98c02c919d934c1f6b5961cad93b
parent8f0183938667c570f3ae3e3a6ab9be68676735ce (diff)
downloadbusybox-w32-8fa1bf7cd6fefc5ac3fb13eb85569d874e84f88e.tar.gz
busybox-w32-8fa1bf7cd6fefc5ac3fb13eb85569d874e84f88e.tar.bz2
busybox-w32-8fa1bf7cd6fefc5ac3fb13eb85569d874e84f88e.zip
Fix a silly logic error which caused symlinks to be printed twice, and
wrongly caused the return code to be an error. -Erik
-rw-r--r--coreutils/du.c9
-rw-r--r--du.c9
2 files changed, 8 insertions, 10 deletions
diff --git a/coreutils/du.c b/coreutils/du.c
index 1966e3559..fb649aee5 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -149,8 +149,8 @@ static long du(char *filename)
149 /* Don't add in stuff pointed to by symbolic links */ 149 /* Don't add in stuff pointed to by symbolic links */
150 if (S_ISLNK(statbuf.st_mode)) { 150 if (S_ISLNK(statbuf.st_mode)) {
151 sum = 0L; 151 sum = 0L;
152 if (du_depth == 1) 152 if (du_depth == 1) {
153 print(sum, filename); 153 }
154 } 154 }
155 if (S_ISDIR(statbuf.st_mode)) { 155 if (S_ISDIR(statbuf.st_mode)) {
156 DIR *dir; 156 DIR *dir;
@@ -236,8 +236,7 @@ int du_main(int argc, char **argv)
236 long sum; 236 long sum;
237 237
238 for (i=optind; i < argc; i++) { 238 for (i=optind; i < argc; i++) {
239 if ((sum = du(argv[i])) == 0) 239 sum = du(argv[i]);
240 status = EXIT_FAILURE;
241 if(is_directory(argv[i], FALSE, NULL)==FALSE) { 240 if(is_directory(argv[i], FALSE, NULL)==FALSE) {
242 print_normal(sum, argv[i]); 241 print_normal(sum, argv[i]);
243 } 242 }
@@ -248,7 +247,7 @@ int du_main(int argc, char **argv)
248 return status; 247 return status;
249} 248}
250 249
251/* $Id: du.c,v 1.49 2001/06/13 08:02:44 andersen Exp $ */ 250/* $Id: du.c,v 1.50 2001/06/30 17:54:20 andersen Exp $ */
252/* 251/*
253Local Variables: 252Local Variables:
254c-file-style: "linux" 253c-file-style: "linux"
diff --git a/du.c b/du.c
index 1966e3559..fb649aee5 100644
--- a/du.c
+++ b/du.c
@@ -149,8 +149,8 @@ static long du(char *filename)
149 /* Don't add in stuff pointed to by symbolic links */ 149 /* Don't add in stuff pointed to by symbolic links */
150 if (S_ISLNK(statbuf.st_mode)) { 150 if (S_ISLNK(statbuf.st_mode)) {
151 sum = 0L; 151 sum = 0L;
152 if (du_depth == 1) 152 if (du_depth == 1) {
153 print(sum, filename); 153 }
154 } 154 }
155 if (S_ISDIR(statbuf.st_mode)) { 155 if (S_ISDIR(statbuf.st_mode)) {
156 DIR *dir; 156 DIR *dir;
@@ -236,8 +236,7 @@ int du_main(int argc, char **argv)
236 long sum; 236 long sum;
237 237
238 for (i=optind; i < argc; i++) { 238 for (i=optind; i < argc; i++) {
239 if ((sum = du(argv[i])) == 0) 239 sum = du(argv[i]);
240 status = EXIT_FAILURE;
241 if(is_directory(argv[i], FALSE, NULL)==FALSE) { 240 if(is_directory(argv[i], FALSE, NULL)==FALSE) {
242 print_normal(sum, argv[i]); 241 print_normal(sum, argv[i]);
243 } 242 }
@@ -248,7 +247,7 @@ int du_main(int argc, char **argv)
248 return status; 247 return status;
249} 248}
250 249
251/* $Id: du.c,v 1.49 2001/06/13 08:02:44 andersen Exp $ */ 250/* $Id: du.c,v 1.50 2001/06/30 17:54:20 andersen Exp $ */
252/* 251/*
253Local Variables: 252Local Variables:
254c-file-style: "linux" 253c-file-style: "linux"