mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
tools/nolibc/stdio: let perror work when NOLIBC_IGNORE_ERRNO is set
There is no errno variable when NOLIBC_IGNORE_ERRNO is defined. As such,
simply print the message with "unknown error" rather than the integer
value of errno.
Fixes: acab7bcdb1 ("tools/nolibc/stdio: add perror() to report the errno value")
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
089c0a9853
commit
c485ca3aff
@@ -600,7 +600,11 @@ int sscanf(const char *str, const char *format, ...)
|
||||
static __attribute__((unused))
|
||||
void perror(const char *msg)
|
||||
{
|
||||
#ifdef NOLIBC_IGNORE_ERRNO
|
||||
fprintf(stderr, "%s%sunknown error\n", (msg && *msg) ? msg : "", (msg && *msg) ? ": " : "");
|
||||
#else
|
||||
fprintf(stderr, "%s%serrno=%d\n", (msg && *msg) ? msg : "", (msg && *msg) ? ": " : "", errno);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
|
||||
Reference in New Issue
Block a user