aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-16 18:23:43 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-16 19:14:45 +0100
commit2bad3a305b5934d17e817a8fbb9c42ee04dc5a3c (patch)
treee37badceaeaeb6fc5aeeb687e0036bcef3234677
parent3f7fb2c89ad75bbdd3b69e302124c8179c273bb4 (diff)
downloadbusybox-w32-2bad3a305b5934d17e817a8fbb9c42ee04dc5a3c.tar.gz
busybox-w32-2bad3a305b5934d17e817a8fbb9c42ee04dc5a3c.tar.bz2
busybox-w32-2bad3a305b5934d17e817a8fbb9c42ee04dc5a3c.zip
ash: jobs: Replace some uses of fmtstr with stpcpy/stpncpy
Upstream commit: Date: Sat, 19 May 2018 02:39:45 +0800 jobs: Replace some uses of fmtstr with stpcpy/stpncpy Some uses of fmtstr, particularly the ones without a format string, can be replaced with stpcpy or stpncpy. This patch does that so we don't have to introduce unnecessary format strings in order to silence compiler warnings. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c
index a006a1c26..75edebd8d 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4203,12 +4203,11 @@ fg_bgcmd(int argc UNUSED_PARAM, char **argv)
4203#endif 4203#endif
4204 4204
4205static int 4205static int
4206sprint_status48(char *s, int status, int sigonly) 4206sprint_status48(char *os, int status, int sigonly)
4207{ 4207{
4208 int col; 4208 char *s = os;
4209 int st; 4209 int st;
4210 4210
4211 col = 0;
4212 if (!WIFEXITED(status)) { 4211 if (!WIFEXITED(status)) {
4213#if JOBS 4212#if JOBS
4214 if (WIFSTOPPED(status)) 4213 if (WIFSTOPPED(status))
@@ -4226,17 +4225,17 @@ sprint_status48(char *s, int status, int sigonly)
4226 } 4225 }
4227 st &= 0x7f; 4226 st &= 0x7f;
4228//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata 4227//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata
4229 col = fmtstr(s, 32, strsignal(st)); 4228 //s = stpncpy(s, strsignal(st), 32); //not all libc have stpncpy()
4229 s += fmtstr(s, 32, strsignal(st));
4230 if (WCOREDUMP(status)) { 4230 if (WCOREDUMP(status)) {
4231 strcpy(s + col, " (core dumped)"); 4231 s = stpcpy(s, " (core dumped)");
4232 col += sizeof(" (core dumped)")-1;
4233 } 4232 }
4234 } else if (!sigonly) { 4233 } else if (!sigonly) {
4235 st = WEXITSTATUS(status); 4234 st = WEXITSTATUS(status);
4236 col = fmtstr(s, 16, (st ? "Done(%d)" : "Done"), st); 4235 s += fmtstr(s, 16, (st ? "Done(%d)" : "Done"), st);
4237 } 4236 }
4238 out: 4237 out:
4239 return col; 4238 return s - os;
4240} 4239}
4241 4240
4242static int 4241static int