mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
Thomas Weißschuh
parent
4ada5679f1
commit
fbd1b7f6b3
@@ -321,11 +321,13 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char
|
||||
if (!outstr)
|
||||
outstr="(null)";
|
||||
}
|
||||
#ifndef NOLIBC_IGNORE_ERRNO
|
||||
else if (c == 'm') {
|
||||
#ifdef NOLIBC_IGNORE_ERRNO
|
||||
outstr = "unknown error";
|
||||
#else
|
||||
outstr = strerror(errno);
|
||||
}
|
||||
#endif /* NOLIBC_IGNORE_ERRNO */
|
||||
}
|
||||
else if (c == '%') {
|
||||
/* queue it verbatim */
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user