aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stat.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 22:31:07 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 22:31:07 +0000
commitb75fe798bb26fbf16a3251decd72bc20b44a00c5 (patch)
treecc11b07df97c84c6fb90c8c6913726b8dd25eec6 /coreutils/stat.c
parentce02b157beff1a8031595364c2fb654034e608b5 (diff)
downloadbusybox-w32-b75fe798bb26fbf16a3251decd72bc20b44a00c5.tar.gz
busybox-w32-b75fe798bb26fbf16a3251decd72bc20b44a00c5.tar.bz2
busybox-w32-b75fe798bb26fbf16a3251decd72bc20b44a00c5.zip
stat: pointers are not 0L, they are NULL
man: better error handling
Diffstat (limited to 'coreutils/stat.c')
-rw-r--r--coreutils/stat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index b2b1913a9..c34c06acb 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -240,14 +240,14 @@ static void print_stat(char *pformat, const char m,
240 } else if (m == 'U') { 240 } else if (m == 'U') {
241 setpwent(); 241 setpwent();
242 pw_ent = getpwuid(statbuf->st_uid); 242 pw_ent = getpwuid(statbuf->st_uid);
243 printfs(pformat, (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN"); 243 printfs(pformat, (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN");
244 } else if (m == 'g') { 244 } else if (m == 'g') {
245 strcat(pformat, "lu"); 245 strcat(pformat, "lu");
246 printf(pformat, (unsigned long) statbuf->st_gid); 246 printf(pformat, (unsigned long) statbuf->st_gid);
247 } else if (m == 'G') { 247 } else if (m == 'G') {
248 setgrent(); 248 setgrent();
249 gw_ent = getgrgid(statbuf->st_gid); 249 gw_ent = getgrgid(statbuf->st_gid);
250 printfs(pformat, (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN"); 250 printfs(pformat, (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN");
251 } else if (m == 't') { 251 } else if (m == 't') {
252 strcat(pformat, "lx"); 252 strcat(pformat, "lx");
253 printf(pformat, (unsigned long) major(statbuf->st_rdev)); 253 printf(pformat, (unsigned long) major(statbuf->st_rdev));
@@ -609,9 +609,9 @@ static bool do_stat(const char *filename, const char *format)
609 (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), 609 (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
610 bb_mode_string(statbuf.st_mode), 610 bb_mode_string(statbuf.st_mode),
611 (unsigned long) statbuf.st_uid, 611 (unsigned long) statbuf.st_uid,
612 (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN", 612 (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN",
613 (unsigned long) statbuf.st_gid, 613 (unsigned long) statbuf.st_gid,
614 (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN"); 614 (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN");
615#if ENABLE_SELINUX 615#if ENABLE_SELINUX
616 printf(" S_Context: %lc\n", *scontext); 616 printf(" S_Context: %lc\n", *scontext);
617#endif 617#endif