diff options
author | Ron Yorston <rmy@pobox.com> | 2021-10-14 13:28:05 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-10-14 13:28:05 +0100 |
commit | a0366fde4cadbdce03540c683611587dbcfb3c48 (patch) | |
tree | 1311cd03a05954ac05cacaf73bd986032ab86178 | |
parent | 4daf57b4fdc80422d6448c0a7914699fdedb95b8 (diff) | |
download | busybox-w32-a0366fde4cadbdce03540c683611587dbcfb3c48.tar.gz busybox-w32-a0366fde4cadbdce03540c683611587dbcfb3c48.tar.bz2 busybox-w32-a0366fde4cadbdce03540c683611587dbcfb3c48.zip |
ash: silence compiler warnings
On 64-bit systems mingw-w64 defines pid_t as a 64-bit integer so
some printf calls caused compiler warnings.
-rw-r--r-- | include/libbb.h | 6 | ||||
-rw-r--r-- | shell/ash.c | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 098619305..9aff42e67 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -295,6 +295,12 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | |||
295 | #define LL_FMT "ll" | 295 | #define LL_FMT "ll" |
296 | #endif | 296 | #endif |
297 | 297 | ||
298 | #if ENABLE_PLATFORM_MINGW32 && defined(_WIN64) | ||
299 | #define PID_FMT "I64" | ||
300 | #else | ||
301 | #define PID_FMT | ||
302 | #endif | ||
303 | |||
298 | /* Large file support */ | 304 | /* Large file support */ |
299 | /* Note that CONFIG_LFS=y forces bbox to be built with all common ops | 305 | /* Note that CONFIG_LFS=y forces bbox to be built with all common ops |
300 | * (stat, lseek etc) mapped to "largefile" variants by libc. | 306 | * (stat, lseek etc) mapped to "largefile" variants by libc. |
diff --git a/shell/ash.c b/shell/ash.c index 98da20f8a..f211df83a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -5070,7 +5070,7 @@ showjob(struct job *jp, int mode) | |||
5070 | 5070 | ||
5071 | if (mode & SHOW_ONLY_PGID) { /* jobs -p */ | 5071 | if (mode & SHOW_ONLY_PGID) { /* jobs -p */ |
5072 | /* just output process (group) id of pipeline */ | 5072 | /* just output process (group) id of pipeline */ |
5073 | fprintf(out, "%d\n", ps->ps_pid); | 5073 | fprintf(out, "%"PID_FMT"d\n", ps->ps_pid); |
5074 | return; | 5074 | return; |
5075 | } | 5075 | } |
5076 | 5076 | ||
@@ -5083,7 +5083,7 @@ showjob(struct job *jp, int mode) | |||
5083 | s[col - 3] = '-'; | 5083 | s[col - 3] = '-'; |
5084 | 5084 | ||
5085 | if (mode & SHOW_PIDS) | 5085 | if (mode & SHOW_PIDS) |
5086 | col += fmtstr(s + col, 16, "%d ", ps->ps_pid); | 5086 | col += fmtstr(s + col, 16, "%"PID_FMT"d ", ps->ps_pid); |
5087 | 5087 | ||
5088 | psend = ps + jp->nprocs; | 5088 | psend = ps + jp->nprocs; |
5089 | 5089 | ||
@@ -5114,7 +5114,7 @@ showjob(struct job *jp, int mode) | |||
5114 | s[0] = '\0'; | 5114 | s[0] = '\0'; |
5115 | col = 33; | 5115 | col = 33; |
5116 | if (mode & SHOW_PIDS) | 5116 | if (mode & SHOW_PIDS) |
5117 | col = fmtstr(s, 48, "\n%*c%d ", indent_col, ' ', ps->ps_pid) - 1; | 5117 | col = fmtstr(s, 48, "\n%*c%"PID_FMT"d ", indent_col, ' ', ps->ps_pid) - 1; |
5118 | start: | 5118 | start: |
5119 | #if ENABLE_PLATFORM_POSIX || JOBS_WIN32 | 5119 | #if ENABLE_PLATFORM_POSIX || JOBS_WIN32 |
5120 | fprintf(out, "%s%*c%s%s", | 5120 | fprintf(out, "%s%*c%s%s", |