diff options
| author | Shipwreckt <me@shipwreckt.co.uk> | 2025-11-07 23:27:55 +0000 |
|---|---|---|
| committer | Shipwreckt <me@shipwreckt.co.uk> | 2025-11-07 23:27:55 +0000 |
| commit | 470d7fb1245ec7cd04a185fe0a5a720ebe6afdc2 (patch) | |
| tree | dfe7d3128f8145c832014082cfe6b43f9b3f647b /files/config/suckless/dwm/util.c | |
| parent | 1ae24861a06d773836fb674814aa03df90bbb095 (diff) | |
Diffstat (limited to 'files/config/suckless/dwm/util.c')
| -rw-r--r-- | files/config/suckless/dwm/util.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/files/config/suckless/dwm/util.c b/files/config/suckless/dwm/util.c index 96b82c9..8e26a51 100644 --- a/files/config/suckless/dwm/util.c +++ b/files/config/suckless/dwm/util.c @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include <errno.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -10,17 +11,17 @@ void die(const char *fmt, ...) { va_list ap; + int saved_errno; + + saved_errno = errno; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - if (fmt[0] && fmt[strlen(fmt)-1] == ':') { - fputc(' ', stderr); - perror(NULL); - } else { - fputc('\n', stderr); - } + if (fmt[0] && fmt[strlen(fmt)-1] == ':') + fprintf(stderr, " %s", strerror(saved_errno)); + fputc('\n', stderr); exit(1); } |
