diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-10 19:35:51 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-10 19:35:51 +0200 |
commit | ada1f504fd1ec1797515267f69029df6ea113f0f (patch) | |
tree | 5d1f51253fb3b502bbaf7d21ffb1bbcd957bfa88 /Libraries/LibC | |
parent | 026a8be4e576e30cda83801a25c54ed3ea8fe464 (diff) | |
download | serenity-ada1f504fd1ec1797515267f69029df6ea113f0f.zip |
LibC: Make sure perror() is consistent about the errno it prints
Diffstat (limited to 'Libraries/LibC')
-rw-r--r-- | Libraries/LibC/stdio.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp index 84c1d94996..7a5e96ca33 100644 --- a/Libraries/LibC/stdio.cpp +++ b/Libraries/LibC/stdio.cpp @@ -425,8 +425,9 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...) void perror(const char* s) { - dbg() << "perror(): " << strerror(errno); - fprintf(stderr, "%s: %s\n", s, strerror(errno)); + int saved_errno = errno; + dbg() << "perror(): " << strerror(saved_errno); + fprintf(stderr, "%s: %s\n", s, strerror(saved_errno)); } FILE* fopen(const char* pathname, const char* mode) |