From 590b6b9188e75ba46c42995984a1c2fa06adb6d6 Mon Sep 17 00:00:00 2001 From: Cristian Rodríguez Date: Sat, 24 May 2014 00:10:36 -0400 Subject: Use %m instead of strerror(errno) where appropiate --- src/journal/sd-journal.c | 6 ++---- src/libsystemd-network/sd-dhcp-client.c | 4 ++-- src/nspawn/nspawn.c | 2 +- src/shared/label.c | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 11de8ef45e..ca805f83fe 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -1455,8 +1455,7 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname) de = readdir(d); if (!de && errno != 0) { r = -errno; - log_debug("Failed to read directory %s: %s", - m->path, strerror(errno)); + log_debug("Failed to read directory %s: %m", m->path); return r; } if (!de) @@ -1546,8 +1545,7 @@ static int add_root_directory(sd_journal *j, const char *p) { de = readdir(d); if (!de && errno != 0) { r = -errno; - log_debug("Failed to read directory %s: %s", - m->path, strerror(errno)); + log_debug("Failed to read directory %s: %m", m->path); return r; } if (!de) diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 67593c42cd..0300a6be93 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -1200,7 +1200,7 @@ static int client_receive_message_udp(sd_event_source *s, int fd, len = read(fd, message, buflen); if (len < 0) { log_dhcp_client(client, "could not receive message from UDP " - "socket: %s", strerror(errno)); + "socket: %m"); return 0; } else if ((size_t)len < sizeof(DHCPMessage)) return 0; @@ -1245,7 +1245,7 @@ static int client_receive_message_raw(sd_event_source *s, int fd, len = recvmsg(fd, &msg, 0); if (len < 0) { log_dhcp_client(client, "could not receive message from raw " - "socket: %s", strerror(errno)); + "socket: %m"); return 0; } else if ((size_t)len < sizeof(DHCPPacket)) return 0; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index eb9c5e0d6c..73158a0518 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -657,7 +657,7 @@ static int mount_binds(const char *dest, char **l, unsigned long flags) { return r; } } else { - log_error("Failed to bind mount %s: %s", *x, strerror(errno)); + log_error("Failed to bind mount %s: %m", *x); return -errno; } /* Create the mount point, but be conservative -- refuse to create block diff --git a/src/shared/label.c b/src/shared/label.c index 70e5c85a11..3b7b86e8fa 100644 --- a/src/shared/label.c +++ b/src/shared/label.c @@ -79,7 +79,7 @@ static int smack_relabel_in_dev(const char *path) { r = setxattr(path, "security.SMACK64", label, strlen(label), 0); if (r < 0) { - log_error("Smack relabeling \"%s\" %s", path, strerror(errno)); + log_error("Smack relabeling \"%s\" %m", path); return -errno; } #endif -- cgit v1.2.3-54-g00ecf