summaryrefslogtreecommitdiffhomepage
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/chmod.c3
-rw-r--r--coreutils/ls.c3
-rw-r--r--coreutils/stat.c6
3 files changed, 8 insertions, 4 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index 8e3e1387e..5832cc51b 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -91,8 +91,9 @@ static int FAST_FUNC fileAction(struct recursive_state *state,
|| (OPT_CHANGED
&& (statbuf->st_mode & 07777) != (newmode & 07777))
) {
+ char modestr[12];
printf("mode of '%s' changed to %04o (%s)\n", fileName,
- newmode & 07777, bb_mode_string(newmode)+1);
+ newmode & 07777, bb_mode_string(modestr, newmode)+1);
}
return TRUE;
}
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 9e8561606..9a1264e65 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -503,7 +503,8 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
column += printf("%6"OFF_FMT"u ", (off_t) (dn->dn_blocks >> 1));
if (opt & OPT_l) {
/* long listing: show mode */
- column += printf("%-10s ", (char *) bb_mode_string(dn->dn_mode));
+ char modestr[12];
+ column += printf("%-10s ", (char *) bb_mode_string(modestr, dn->dn_mode));
/* long listing: show number of links */
column += printf("%4lu ", (long) dn->dn_nlink);
/* long listing: show user/group */
diff --git a/coreutils/stat.c b/coreutils/stat.c
index a8393468e..2c2909e7e 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -339,7 +339,8 @@ static void FAST_FUNC print_stat(char *pformat, const char m,
strcat(pformat, "lo");
printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)));
} else if (m == 'A') {
- printfs(pformat, bb_mode_string(statbuf->st_mode));
+ char modestr[12];
+ printfs(pformat, bb_mode_string(modestr, statbuf->st_mode));
} else if (m == 'f') {
strcat(pformat, "lx");
printf(pformat, (unsigned long) statbuf->st_mode);
@@ -702,6 +703,7 @@ static bool do_stat(const char *filename, const char *format)
bb_putchar('\n');
# endif
} else {
+ char modestr[12];
char *linkname = NULL;
struct passwd *pw_ent;
struct group *gw_ent;
@@ -736,7 +738,7 @@ static bool do_stat(const char *filename, const char *format)
bb_putchar('\n');
printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n",
(unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
- bb_mode_string(statbuf.st_mode),
+ bb_mode_string(modestr, statbuf.st_mode),
(unsigned long) statbuf.st_uid,
(pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN",
(unsigned long) statbuf.st_gid,