Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/nolibc: implement %m if errno is not defined

For improved compatibility, print %m as "unknown error" when nolibc is
compiled using NOLIBC_IGNORE_ERRNO.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

authored by

Benjamin Berg and committed by
Thomas Weißschuh
fbd1b7f6 4ada5679

+4 -2
+4 -2
tools/include/nolibc/stdio.h
··· 321 321 if (!outstr) 322 322 outstr="(null)"; 323 323 } 324 - #ifndef NOLIBC_IGNORE_ERRNO 325 324 else if (c == 'm') { 325 + #ifdef NOLIBC_IGNORE_ERRNO 326 + outstr = "unknown error"; 327 + #else 326 328 outstr = strerror(errno); 327 - } 328 329 #endif /* NOLIBC_IGNORE_ERRNO */ 330 + } 329 331 else if (c == '%') { 330 332 /* queue it verbatim */ 331 333 continue;