summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-09-21 15:19:18 +0100
committerRon Yorston <rmy@pobox.com>2021-09-21 15:19:18 +0100
commit90b3ba992ecb39e32e5a66b2e37579becc56d286 (patch)
tree4c4a2c9e1baeb8230d78efd058bb4bcabc3fd12b /coreutils
parentdf34f5e92b1d10f0bb858d2ea6e8c249e87ac593 (diff)
parent56f0e886db0543a27f369d7f95eb9da2fb3d069c (diff)
downloadbusybox-w32-90b3ba992ecb39e32e5a66b2e37579becc56d286.tar.gz
busybox-w32-90b3ba992ecb39e32e5a66b2e37579becc56d286.tar.bz2
busybox-w32-90b3ba992ecb39e32e5a66b2e37579becc56d286.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/chmod.c6
-rw-r--r--coreutils/ls.c3
-rw-r--r--coreutils/stat.c6
3 files changed, 10 insertions, 5 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index e260adab2..5832cc51b 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -88,10 +88,12 @@ static int FAST_FUNC fileAction(struct recursive_state *state,
88 88
89 if (chmod(fileName, newmode) == 0) { 89 if (chmod(fileName, newmode) == 0) {
90 if (OPT_VERBOSE 90 if (OPT_VERBOSE
91 || (OPT_CHANGED && statbuf->st_mode != newmode) 91 || (OPT_CHANGED
92 && (statbuf->st_mode & 07777) != (newmode & 07777))
92 ) { 93 ) {
94 char modestr[12];
93 printf("mode of '%s' changed to %04o (%s)\n", fileName, 95 printf("mode of '%s' changed to %04o (%s)\n", fileName,
94 newmode & 07777, bb_mode_string(newmode)+1); 96 newmode & 07777, bb_mode_string(modestr, newmode)+1);
95 } 97 }
96 return TRUE; 98 return TRUE;
97 } 99 }
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 0330f62df..58b8fde75 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -510,7 +510,8 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
510 column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1)); 510 column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1));
511 if (opt & OPT_l) { 511 if (opt & OPT_l) {
512 /* long listing: show mode */ 512 /* long listing: show mode */
513 column += printf("%-10s ", (char *) bb_mode_string(dn->dn_mode)); 513 char modestr[12];
514 column += printf("%-10s ", bb_mode_string(modestr, dn->dn_mode));
514 /* long listing: show number of links */ 515 /* long listing: show number of links */
515 column += printf("%4lu ", (long) dn->dn_nlink); 516 column += printf("%4lu ", (long) dn->dn_nlink);
516 /* long listing: show user/group */ 517 /* long listing: show user/group */
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 96cbf6dc6..940ade89a 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -340,7 +340,8 @@ static void FAST_FUNC print_stat(char *pformat, const char m,
340 strcat(pformat, "lo"); 340 strcat(pformat, "lo");
341 printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO))); 341 printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)));
342 } else if (m == 'A') { 342 } else if (m == 'A') {
343 printfs(pformat, bb_mode_string(statbuf->st_mode)); 343 char modestr[12];
344 printfs(pformat, bb_mode_string(modestr, statbuf->st_mode));
344 } else if (m == 'f') { 345 } else if (m == 'f') {
345 strcat(pformat, "lx"); 346 strcat(pformat, "lx");
346 printf(pformat, (unsigned long) statbuf->st_mode); 347 printf(pformat, (unsigned long) statbuf->st_mode);
@@ -703,6 +704,7 @@ static bool do_stat(const char *filename, const char *format)
703 bb_putchar('\n'); 704 bb_putchar('\n');
704# endif 705# endif
705 } else { 706 } else {
707 char modestr[12];
706 char *linkname = NULL; 708 char *linkname = NULL;
707 struct passwd *pw_ent; 709 struct passwd *pw_ent;
708 struct group *gw_ent; 710 struct group *gw_ent;
@@ -737,7 +739,7 @@ static bool do_stat(const char *filename, const char *format)
737 bb_putchar('\n'); 739 bb_putchar('\n');
738 printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n", 740 printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n",
739 (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)), 741 (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
740 bb_mode_string(statbuf.st_mode), 742 bb_mode_string(modestr, statbuf.st_mode),
741 (unsigned long) statbuf.st_uid, 743 (unsigned long) statbuf.st_uid,
742 (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN", 744 (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN",
743 (unsigned long) statbuf.st_gid, 745 (unsigned long) statbuf.st_gid,