diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2018-03-27 02:59:41 -0700 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2018-03-27 02:59:41 -0700 |
| commit | 0120a57d797ad458c614f08c089d0390e76869dd (patch) | |
| tree | 1f053a5e7a729574e7d2adab442dc22b0ad1b1ef | |
| parent | a0edc48046a34107f7c60b2edecba66049b4544d (diff) | |
save errno to avoid issues with it being overwritten
| -rw-r--r-- | common/log.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/log.c b/common/log.c index 6dc9d743..877534c8 100644 --- a/common/log.c +++ b/common/log.c @@ -127,6 +127,7 @@ void _sway_abort(const char *filename, int line, const char* format, ...) { } void sway_log_errno(log_importance_t verbosity, char* format, ...) { + int errsv = errno; if (verbosity <= v) { unsigned int c = verbosity; if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { @@ -145,7 +146,7 @@ void sway_log_errno(log_importance_t verbosity, char* format, ...) { va_end(args); fprintf(stderr, ": "); - fprintf(stderr, "%s", strerror(errno)); + fprintf(stderr, "%s", strerror(errsv)); if (colored && isatty(STDERR_FILENO)) { fprintf(stderr, "\x1B[0m"); |
