1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +00:00

LibC: Make sure perror() is consistent about the errno it prints

This commit is contained in:
Andreas Kling 2019-09-10 19:35:51 +02:00
parent 026a8be4e5
commit ada1f504fd

View file

@ -425,8 +425,9 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...)
void perror(const char* s) void perror(const char* s)
{ {
dbg() << "perror(): " << strerror(errno); int saved_errno = errno;
fprintf(stderr, "%s: %s\n", s, strerror(errno)); dbg() << "perror(): " << strerror(saved_errno);
fprintf(stderr, "%s: %s\n", s, strerror(saved_errno));
} }
FILE* fopen(const char* pathname, const char* mode) FILE* fopen(const char* pathname, const char* mode)