Replace %m GNUism with strerror(errno)

Even musl libc supports %m today, as well as most syslog daemons, but
that's no excuse to use this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-02-07 13:21:55 +01:00
1 parent 3e8d63c29c
commit fccba7cd4c
4 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -141,7 +141,7 @@ static void rtc_restore(void *arg)
else if (ENOENT == errno) else if (ENOENT == errno)
logit(LOG_ERR, "RTC has no previously saved (valid) time."); logit(LOG_ERR, "RTC has no previously saved (valid) time.");
else else
logit(LOG_ERR, "RTC error code %d: %m", errno); logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
rc = 2; rc = 2;
goto out; goto out;
} }
+2 -2
View File
@@ -249,7 +249,7 @@ static void prepare_tty(char *tty, speed_t speed, char *procname, struct rlimit
fd = open(tty, O_RDWR); fd = open(tty, O_RDWR);
if (fd < 0) { if (fd < 0) {
logit(LOG_ERR, "Failed opening %s: %m", tty); logit(LOG_ERR, "Failed opening %s: %s", tty, strerror(errno));
_exit(1); _exit(1);
} }
@@ -259,7 +259,7 @@ static void prepare_tty(char *tty, speed_t speed, char *procname, struct rlimit
close(fd); close(fd);
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0) if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
logit(LOG_WARNING, "Failed TIOCSCTTY on %s: %m", tty); logit(LOG_WARNING, "Failed TIOCSCTTY on %s: %s", tty, strerror(errno));
/* /*
* Reset to sane defaults in case of messup from prev. session * Reset to sane defaults in case of messup from prev. session
+1 -1
View File
@@ -174,7 +174,7 @@ static void socket_cb(uev_t *w, void *arg, int events)
_d("%s: Got socket event ...", svc->cmd); _d("%s: Got socket event ...", svc->cmd);
if (UEV_ERROR == events) { if (UEV_ERROR == events) {
logit(LOG_INFO, "%s: Socket error, aborting: %m", svc->cmd); logit(LOG_INFO, "%s: Socket error, aborting: %s", svc->cmd, strerror(errno));
return; return;
} }
+1 -1
View File
@@ -43,7 +43,7 @@
#define _d(fmt, args...) logit(LOG_DEBUG, "%s():" fmt "\n", __func__, ##args) #define _d(fmt, args...) logit(LOG_DEBUG, "%s():" fmt "\n", __func__, ##args)
#define _w(fmt, args...) logit(LOG_WARNING, "%s():" fmt "\n", __func__, ##args) #define _w(fmt, args...) logit(LOG_WARNING, "%s():" fmt "\n", __func__, ##args)
#define _e(fmt, args...) logit(LOG_ERR, "%s():" fmt "\n", __func__, ##args) #define _e(fmt, args...) logit(LOG_ERR, "%s():" fmt "\n", __func__, ##args)
#define _pe(fmt, args...) logit(LOG_ERR, "%s():" fmt ": %m\n", __func__, ##args) #define _pe(fmt, args...) logit(LOG_ERR, "%s():" fmt ": %s\n", __func__, ##args, strerror(errno))
void log_init (int dbg); void log_init (int dbg);
void log_exit (void); void log_exit (void);