diff options
-rw-r--r-- | common/log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/log.c b/common/log.c index 6dc9d743..1b46d58f 100644 --- a/common/log.c +++ b/common/log.c | |||
@@ -127,6 +127,7 @@ void _sway_abort(const char *filename, int line, const char* format, ...) { | |||
127 | } | 127 | } |
128 | 128 | ||
129 | void sway_log_errno(log_importance_t verbosity, char* format, ...) { | 129 | void sway_log_errno(log_importance_t verbosity, char* format, ...) { |
130 | int errsv = errno; | ||
130 | if (verbosity <= v) { | 131 | if (verbosity <= v) { |
131 | unsigned int c = verbosity; | 132 | unsigned int c = verbosity; |
132 | if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { | 133 | if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { |
@@ -145,13 +146,14 @@ void sway_log_errno(log_importance_t verbosity, char* format, ...) { | |||
145 | va_end(args); | 146 | va_end(args); |
146 | 147 | ||
147 | fprintf(stderr, ": "); | 148 | fprintf(stderr, ": "); |
148 | fprintf(stderr, "%s", strerror(errno)); | 149 | fprintf(stderr, "%s", strerror(errsv)); |
149 | 150 | ||
150 | if (colored && isatty(STDERR_FILENO)) { | 151 | if (colored && isatty(STDERR_FILENO)) { |
151 | fprintf(stderr, "\x1B[0m"); | 152 | fprintf(stderr, "\x1B[0m"); |
152 | } | 153 | } |
153 | fprintf(stderr, "\n"); | 154 | fprintf(stderr, "\n"); |
154 | } | 155 | } |
156 | errno = errsv; | ||
155 | } | 157 | } |
156 | 158 | ||
157 | bool _sway_assert(bool condition, const char *filename, int line, const char* format, ...) { | 159 | bool _sway_assert(bool condition, const char *filename, int line, const char* format, ...) { |