c: print strerror() instead of error code.

This changes error() behavior to match what glibc already does.
This commit is contained in:
Érico Nogueira 2021-06-04 13:10:28 -03:00 committed by Craig Small
parent 48b977f2dc
commit 67eddacfc9

View File

@ -118,7 +118,7 @@ static void error(int status, int errnum, const char *format, ...)
vfprintf(stderr, format, argp); vfprintf(stderr, format, argp);
va_end(argp); va_end(argp);
if (errnum != 0) if (errnum != 0)
fprintf(stderr, ": error code %d", errnum); fprintf(stderr, ": %s", strerror(errnum));
fprintf(stderr, "\n"); fprintf(stderr, "\n");
if (status != 0) if (status != 0)
exit(status); exit(status);