fix trivial error with inverted exit code in ls

This commit is contained in:
Denis Vlasenko 2008-06-18 16:38:22 +00:00
parent 55789c6646
commit 4a689e9b49

View File

@ -139,7 +139,7 @@ struct globals {
#if ENABLE_FEATURE_LS_COLOR #if ENABLE_FEATURE_LS_COLOR
smallint show_color; smallint show_color;
#endif #endif
smallint exit_failure; smallint exit_code;
unsigned all_fmt; unsigned all_fmt;
#if ENABLE_FEATURE_AUTOWIDTH #if ENABLE_FEATURE_AUTOWIDTH
unsigned tabstops; // = COLUMN_GAP; unsigned tabstops; // = COLUMN_GAP;
@ -156,7 +156,7 @@ struct globals {
#else #else
enum { show_color = 0 }; enum { show_color = 0 };
#endif #endif
#define exit_failure (G.exit_failure ) #define exit_code (G.exit_code )
#define all_fmt (G.all_fmt ) #define all_fmt (G.all_fmt )
#if ENABLE_FEATURE_AUTOWIDTH #if ENABLE_FEATURE_AUTOWIDTH
#define tabstops (G.tabstops ) #define tabstops (G.tabstops )
@ -206,7 +206,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
#endif #endif
if (stat(fullname, &dstat)) { if (stat(fullname, &dstat)) {
bb_simple_perror_msg(fullname); bb_simple_perror_msg(fullname);
exit_failure = 1; exit_code = EXIT_FAILURE;
return 0; return 0;
} }
} else { } else {
@ -217,7 +217,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
#endif #endif
if (lstat(fullname, &dstat)) { if (lstat(fullname, &dstat)) {
bb_simple_perror_msg(fullname); bb_simple_perror_msg(fullname);
exit_failure = 1; exit_code = EXIT_FAILURE;
return 0; return 0;
} }
} }
@ -529,7 +529,7 @@ static struct dnode **list_dir(const char *path)
nfiles = 0; nfiles = 0;
dir = warn_opendir(path); dir = warn_opendir(path);
if (dir == NULL) { if (dir == NULL) {
exit_failure = 1; exit_code = EXIT_FAILURE;
return NULL; /* could not open the dir */ return NULL; /* could not open the dir */
} }
while ((entry = readdir(dir)) != NULL) { while ((entry = readdir(dir)) != NULL) {
@ -975,5 +975,5 @@ int ls_main(int argc ATTRIBUTE_UNUSED, char **argv)
} }
if (ENABLE_FEATURE_CLEAN_UP) if (ENABLE_FEATURE_CLEAN_UP)
dfree(dnp, nfiles); dfree(dnp, nfiles);
return (exit_failure == 0); return exit_code;
} }