Fix a silly logic error which caused symlinks to be printed twice, and
wrongly caused the return code to be an error. -Erik
This commit is contained in:
parent
8f01839386
commit
8fa1bf7cd6
@ -149,8 +149,8 @@ static long du(char *filename)
|
|||||||
/* Don't add in stuff pointed to by symbolic links */
|
/* Don't add in stuff pointed to by symbolic links */
|
||||||
if (S_ISLNK(statbuf.st_mode)) {
|
if (S_ISLNK(statbuf.st_mode)) {
|
||||||
sum = 0L;
|
sum = 0L;
|
||||||
if (du_depth == 1)
|
if (du_depth == 1) {
|
||||||
print(sum, filename);
|
}
|
||||||
}
|
}
|
||||||
if (S_ISDIR(statbuf.st_mode)) {
|
if (S_ISDIR(statbuf.st_mode)) {
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
@ -236,8 +236,7 @@ int du_main(int argc, char **argv)
|
|||||||
long sum;
|
long sum;
|
||||||
|
|
||||||
for (i=optind; i < argc; i++) {
|
for (i=optind; i < argc; i++) {
|
||||||
if ((sum = du(argv[i])) == 0)
|
sum = du(argv[i]);
|
||||||
status = EXIT_FAILURE;
|
|
||||||
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
|
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
|
||||||
print_normal(sum, argv[i]);
|
print_normal(sum, argv[i]);
|
||||||
}
|
}
|
||||||
@ -248,7 +247,7 @@ int du_main(int argc, char **argv)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: du.c,v 1.49 2001/06/13 08:02:44 andersen Exp $ */
|
/* $Id: du.c,v 1.50 2001/06/30 17:54:20 andersen Exp $ */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "linux"
|
c-file-style: "linux"
|
||||||
|
9
du.c
9
du.c
@ -149,8 +149,8 @@ static long du(char *filename)
|
|||||||
/* Don't add in stuff pointed to by symbolic links */
|
/* Don't add in stuff pointed to by symbolic links */
|
||||||
if (S_ISLNK(statbuf.st_mode)) {
|
if (S_ISLNK(statbuf.st_mode)) {
|
||||||
sum = 0L;
|
sum = 0L;
|
||||||
if (du_depth == 1)
|
if (du_depth == 1) {
|
||||||
print(sum, filename);
|
}
|
||||||
}
|
}
|
||||||
if (S_ISDIR(statbuf.st_mode)) {
|
if (S_ISDIR(statbuf.st_mode)) {
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
@ -236,8 +236,7 @@ int du_main(int argc, char **argv)
|
|||||||
long sum;
|
long sum;
|
||||||
|
|
||||||
for (i=optind; i < argc; i++) {
|
for (i=optind; i < argc; i++) {
|
||||||
if ((sum = du(argv[i])) == 0)
|
sum = du(argv[i]);
|
||||||
status = EXIT_FAILURE;
|
|
||||||
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
|
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
|
||||||
print_normal(sum, argv[i]);
|
print_normal(sum, argv[i]);
|
||||||
}
|
}
|
||||||
@ -248,7 +247,7 @@ int du_main(int argc, char **argv)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: du.c,v 1.49 2001/06/13 08:02:44 andersen Exp $ */
|
/* $Id: du.c,v 1.50 2001/06/30 17:54:20 andersen Exp $ */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "linux"
|
c-file-style: "linux"
|
||||||
|
Loading…
Reference in New Issue
Block a user