diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-01-04 19:52:10 +0700 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-01-04 19:52:10 +0700 |
commit | 8cef222175855ae08f3768a5586b00650240403d (patch) | |
tree | 224364dc08e460fea425df95fc45e1cbc9bbbd96 /coreutils | |
parent | 9fab97cbb70312170739e29a5fbbbe072f07bb78 (diff) | |
parent | cbfeaac7afe31323d46c52da3b98a949232d708e (diff) | |
download | busybox-w32-8cef222175855ae08f3768a5586b00650240403d.tar.gz busybox-w32-8cef222175855ae08f3768a5586b00650240403d.tar.bz2 busybox-w32-8cef222175855ae08f3768a5586b00650240403d.zip |
Merge commit '6722737ece4b8db3e30b53aef8f981f53db1621e^'
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/fsync.c | 2 | ||||
-rw-r--r-- | coreutils/stat.c | 12 | ||||
-rw-r--r-- | coreutils/tail.c | 1 |
3 files changed, 7 insertions, 8 deletions
diff --git a/coreutils/fsync.c b/coreutils/fsync.c index d1fe2b584..b8b463cd1 100644 --- a/coreutils/fsync.c +++ b/coreutils/fsync.c | |||
@@ -27,7 +27,7 @@ int fsync_main(int argc UNUSED_PARAM, char **argv) | |||
27 | 27 | ||
28 | status = EXIT_SUCCESS; | 28 | status = EXIT_SUCCESS; |
29 | do { | 29 | do { |
30 | int fd = open3_or_warn(*argv, O_NOATIME | O_NOCTTY | O_RDONLY, 0); | 30 | int fd = open_or_warn(*argv, O_NOATIME | O_NOCTTY | O_RDONLY); |
31 | 31 | ||
32 | if (fd == -1) { | 32 | if (fd == -1) { |
33 | status = EXIT_FAILURE; | 33 | status = EXIT_FAILURE; |
diff --git a/coreutils/stat.c b/coreutils/stat.c index 777197292..d176d07ea 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -247,14 +247,12 @@ static void FAST_FUNC print_stat(char *pformat, const char m, | |||
247 | strcat(pformat, "lu"); | 247 | strcat(pformat, "lu"); |
248 | printf(pformat, (unsigned long) statbuf->st_uid); | 248 | printf(pformat, (unsigned long) statbuf->st_uid); |
249 | } else if (m == 'U') { | 249 | } else if (m == 'U') { |
250 | setpwent(); | ||
251 | pw_ent = getpwuid(statbuf->st_uid); | 250 | pw_ent = getpwuid(statbuf->st_uid); |
252 | printfs(pformat, (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN"); | 251 | printfs(pformat, (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN"); |
253 | } else if (m == 'g') { | 252 | } else if (m == 'g') { |
254 | strcat(pformat, "lu"); | 253 | strcat(pformat, "lu"); |
255 | printf(pformat, (unsigned long) statbuf->st_gid); | 254 | printf(pformat, (unsigned long) statbuf->st_gid); |
256 | } else if (m == 'G') { | 255 | } else if (m == 'G') { |
257 | setgrent(); | ||
258 | gw_ent = getgrgid(statbuf->st_gid); | 256 | gw_ent = getgrgid(statbuf->st_gid); |
259 | printfs(pformat, (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN"); | 257 | printfs(pformat, (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN"); |
260 | } else if (m == 't') { | 258 | } else if (m == 't') { |
@@ -591,20 +589,20 @@ static bool do_stat(const char *filename, const char *format) | |||
591 | # endif | 589 | # endif |
592 | } else { | 590 | } else { |
593 | char *linkname = NULL; | 591 | char *linkname = NULL; |
594 | |||
595 | struct passwd *pw_ent; | 592 | struct passwd *pw_ent; |
596 | struct group *gw_ent; | 593 | struct group *gw_ent; |
597 | setgrent(); | 594 | |
598 | gw_ent = getgrgid(statbuf.st_gid); | 595 | gw_ent = getgrgid(statbuf.st_gid); |
599 | setpwent(); | ||
600 | pw_ent = getpwuid(statbuf.st_uid); | 596 | pw_ent = getpwuid(statbuf.st_uid); |
601 | 597 | ||
602 | if (S_ISLNK(statbuf.st_mode)) | 598 | if (S_ISLNK(statbuf.st_mode)) |
603 | linkname = xmalloc_readlink_or_warn(filename); | 599 | linkname = xmalloc_readlink_or_warn(filename); |
604 | if (linkname) | 600 | if (linkname) { |
605 | printf(" File: '%s' -> '%s'\n", filename, linkname); | 601 | printf(" File: '%s' -> '%s'\n", filename, linkname); |
606 | else | 602 | free(linkname); |
603 | } else { | ||
607 | printf(" File: '%s'\n", filename); | 604 | printf(" File: '%s'\n", filename); |
605 | } | ||
608 | 606 | ||
609 | printf(" Size: %-10llu\tBlocks: %-10llu IO Block: %-6lu %s\n" | 607 | printf(" Size: %-10llu\tBlocks: %-10llu IO Block: %-6lu %s\n" |
610 | "Device: %llxh/%llud\tInode: %-10llu Links: %-5lu", | 608 | "Device: %llxh/%llud\tInode: %-10llu Links: %-5lu", |
diff --git a/coreutils/tail.c b/coreutils/tail.c index 44698f304..df881a37a 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -346,6 +346,7 @@ int tail_main(int argc, char **argv) | |||
346 | } | 346 | } |
347 | if (ENABLE_FEATURE_CLEAN_UP) { | 347 | if (ENABLE_FEATURE_CLEAN_UP) { |
348 | free(fds); | 348 | free(fds); |
349 | free(tailbuf); | ||
349 | } | 350 | } |
350 | return G.status; | 351 | return G.status; |
351 | } | 352 | } |