As pointed out by Kang-Che Sung and verified by Jody Bruchon, the "%m" format placeholder is really not in any open standard.
Also: contrary to Denys' assumption, there are libc versions out there which did not follow GLIBC's example to implement this non-POSIX placeholder. That must be the reason why nothing else in BusyBox' source code relies on %m but uses helpers such as bb_perror_msg() instead. It is very easy, and a good readability improvement, too, to introduce a new helper in ash's source code. Changes since v2: - fixed an erronous vfprintf() that does not take a va_list (thanks, Ron). - inserted the missing %s in the same fprintf() statement. Johannes Schindelin (2): ash: introduce ash_perror_msg_and_raise_error() ash: avoid GLIBC'ism %m shell/ash.c | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) base-commit: be669fa1fdff6f751c8cdd3fc18a9fa7a7f46cd3 Published-As: https://github.com/dscho/busybox-w32/releases/tag/busybox-glibc-ism-v3 Fetch-It-Via: git fetch https://github.com/dscho/busybox-w32 busybox-glibc-ism-v3 Interdiff vs v2: diff --git a/shell/ash.c b/shell/ash.c index 110f9bb21..0fde5791d 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -1264,7 +1264,7 @@ ash_verror_msg(const char *msg, va_list ap, const char *strerr) } vfprintf(stderr, msg, ap); if (strerr) - vfprintf(stderr, ": ", strerr); + fprintf(stderr, ": %s", strerr); newline_and_flush(stderr); } -- 2.13.3.windows.1.13.gaf0c2223da0 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
