summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Buch <boogiewasthere@gmail.com>2013-11-26 09:38:02 +0100
committerDavid Strauss <david@davidstrauss.net>2013-11-26 21:07:46 +1000
commitf5f6d0e25574dd63fb605b81fa7767dd71c454db (patch)
tree3ec0b42888ce9b6895ec264c2a18a394c6d3db3e /src
parent34a6dc7dcaa47a9efe083acc6f5fc6263414465e (diff)
downloadsystemd-f5f6d0e25574dd63fb605b81fa7767dd71c454db.tar.gz
systemd-f5f6d0e25574dd63fb605b81fa7767dd71c454db.tar.bz2
systemd-f5f6d0e25574dd63fb605b81fa7767dd71c454db.zip
tree-wide usage of %m specifier instead of strerror(errno)
Also for log_error() except where a specific error is specified e.g. errno ? strerror(errno) : "Some user specified message"
Diffstat (limited to 'src')
-rw-r--r--src/core/automount.c2
-rw-r--r--src/core/main.c2
-rw-r--r--src/core/manager.c2
-rw-r--r--src/core/mount-setup.c2
-rw-r--r--src/core/service.c4
-rw-r--r--src/initctl/initctl.c12
-rw-r--r--src/journal/coredumpctl.c2
-rw-r--r--src/journal/journald-console.c4
-rw-r--r--src/journal/journald-kmsg.c2
-rw-r--r--src/udev/collect/collect.c6
-rw-r--r--src/udev/scsi_id/scsi_id.c2
-rw-r--r--src/udev/scsi_id/scsi_serial.c8
-rw-r--r--src/udev/udev-rules.c2
13 files changed, 23 insertions, 27 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index 49a64b124f..66e3d78c92 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -304,7 +304,7 @@ static int open_dev_autofs(Manager *m) {
m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY);
if (m->dev_autofs_fd < 0) {
- log_error("Failed to open /dev/autofs: %s", strerror(errno));
+ log_error("Failed to open /dev/autofs: %m");
return -errno;
}
diff --git a/src/core/main.c b/src/core/main.c
index dbc98db84a..69d3a43840 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -131,7 +131,7 @@ _noreturn_ static void crash(int sig) {
pid = fork();
if (pid < 0)
- log_error("Caught <%s>, cannot fork for core dump: %s", signal_to_string(sig), strerror(errno));
+ log_error("Caught <%s>, cannot fork for core dump: %m", signal_to_string(sig));
else if (pid == 0) {
struct rlimit rl = {};
diff --git a/src/core/manager.c b/src/core/manager.c
index aa4baaacc8..65cb73cc9f 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -307,7 +307,7 @@ static int enable_special_signals(Manager *m) {
} else {
/* Enable that we get SIGWINCH on kbrequest */
if (ioctl(fd, KDSIGACCEPT, SIGWINCH) < 0)
- log_warning("Failed to enable kbrequest handling: %s", strerror(errno));
+ log_warning("Failed to enable kbrequest handling: %m");
}
return 0;
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index 73c2698ea3..c601c9742c 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -188,7 +188,7 @@ static int mount_one(const MountPoint *p, bool relabel) {
p->type,
p->flags,
p->options) < 0) {
- log_full((p->mode & MNT_FATAL) ? LOG_ERR : LOG_DEBUG, "Failed to mount %s: %s", p->where, strerror(errno));
+ log_full((p->mode & MNT_FATAL) ? LOG_ERR : LOG_DEBUG, "Failed to mount %s: %m", p->where);
return (p->mode & MNT_FATAL) ? -errno : 0;
}
diff --git a/src/core/service.c b/src/core/service.c
index 28b1465c19..7c5d5d8681 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3507,7 +3507,7 @@ static int service_enumerate(Manager *m) {
d = opendir(path);
if (!d) {
if (errno != ENOENT)
- log_warning("opendir(%s) failed: %s", path, strerror(errno));
+ log_warning("opendir(%s) failed: %m", path);
continue;
}
@@ -3540,7 +3540,7 @@ static int service_enumerate(Manager *m) {
if (access(fpath, X_OK) < 0) {
if (errno != ENOENT)
- log_warning("access() failed on %s: %s", fpath, strerror(errno));
+ log_warning("access() failed on %s: %m", fpath);
continue;
}
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index 0000d6ccd4..284319f9af 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -217,7 +217,7 @@ static int fifo_process(Fifo *f) {
if (errno == EAGAIN)
return 0;
- log_warning("Failed to read from fifo: %s", strerror(errno));
+ log_warning("Failed to read from fifo: %m");
return -1;
}
@@ -278,7 +278,7 @@ static int server_init(Server *s, unsigned n_sockets) {
s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (s->epoll_fd < 0) {
r = -errno;
- log_error("Failed to create epoll object: %s", strerror(errno));
+ log_error("Failed to create epoll object: %m");
goto fail;
}
@@ -305,8 +305,7 @@ static int server_init(Server *s, unsigned n_sockets) {
f = new0(Fifo, 1);
if (!f) {
r = -ENOMEM;
- log_error("Failed to create fifo object: %s",
- strerror(errno));
+ log_error("Failed to create fifo object: %m");
goto fail;
}
@@ -318,8 +317,7 @@ static int server_init(Server *s, unsigned n_sockets) {
if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, fd, &ev) < 0) {
r = -errno;
fifo_free(f);
- log_error("Failed to add fifo fd to epoll object: %s",
- strerror(errno));
+ log_error("Failed to add fifo fd to epoll object: %m");
goto fail;
}
@@ -416,7 +414,7 @@ int main(int argc, char *argv[]) {
if (errno == EINTR)
continue;
- log_error("epoll_wait() failed: %s", strerror(errno));
+ log_error("epoll_wait() failed: %m");
goto fail;
}
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index bcfee46da1..ec65ff5221 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -479,7 +479,7 @@ static int run_gdb(sd_journal *j) {
sz = write(fd, data, len);
if (sz < 0) {
- log_error("Failed to write temporary file: %s", strerror(errno));
+ log_error("Failed to write temporary file: %m");
r = -errno;
goto finish;
}
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index 1ee3afeacc..04c4424a46 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -100,12 +100,12 @@ void server_forward_console(
fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (fd < 0) {
- log_debug("Failed to open %s for logging: %s", tty, strerror(errno));
+ log_debug("Failed to open %s for logging: %m", tty);
goto finish;
}
if (writev(fd, iovec, n) < 0)
- log_debug("Failed to write to %s for logging: %s", tty, strerror(errno));
+ log_debug("Failed to write to %s for logging: %m", tty);
close_nointr_nofail(fd);
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 21649d06ce..af49d8578a 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -88,7 +88,7 @@ void server_forward_kmsg(
IOVEC_SET_STRING(iovec[n++], "\n");
if (writev(s->dev_kmsg_fd, iovec, n) < 0)
- log_debug("Failed to write to /dev/kmsg for logging: %s", strerror(errno));
+ log_debug("Failed to write to /dev/kmsg for logging: %m");
free(ident_buf);
}
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index 1346f27f91..2bbbcd7106 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -97,7 +97,7 @@ static int prepare(char *dir, char *filename)
fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
if (fd < 0)
- fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno));
+ fprintf(stderr, "Cannot open %s: %m\n", buf);
if (lockf(fd,F_TLOCK,0) < 0) {
if (debug)
@@ -109,7 +109,7 @@ static int prepare(char *dir, char *filename)
fprintf(stderr, "Acquired lock on %s\n", buf);
} else {
if (debug)
- fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno));
+ fprintf(stderr, "Could not get lock on %s: %m\n", buf);
}
}
@@ -404,7 +404,7 @@ int main(int argc, char **argv)
us = argv[argi++];
if (signal(SIGALRM, sig_alrm) == SIG_ERR) {
- fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno));
+ fprintf(stderr, "Cannot set SIGALRM: %m\n");
ret = 2;
goto exit;
}
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index ab7c54c3f2..c2cc2ea48d 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -185,7 +185,7 @@ static int get_file_options(struct udev *udev,
if (errno == ENOENT) {
return 1;
} else {
- log_error("can't open %s: %s\n", config_file, strerror(errno));
+ log_error("can't open %s: %m\n", config_file);
return -1;
}
}
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index d522a23a08..4b0711b447 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -362,7 +362,7 @@ resend:
dev_scsi->use_sg = 3;
goto resend;
}
- log_debug("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno));
+ log_debug("%s: ioctl failed: %m\n", dev_scsi->kernel);
goto error;
}
@@ -820,14 +820,12 @@ int scsi_std_inquiry(struct udev *udev,
fd = open(devname, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- log_debug("scsi_id: cannot open %s: %s\n",
- devname, strerror(errno));
+ log_debug("scsi_id: cannot open %s: %m\n", devname);
return 1;
}
if (fstat(fd, &statbuf) < 0) {
- log_debug("scsi_id: cannot stat %s: %s\n",
- devname, strerror(errno));
+ log_debug("scsi_id: cannot stat %s: %m\n", devname);
err = 2;
goto out;
}
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 320f004dc3..9154700bfa 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2595,7 +2595,7 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules)
strscpyl(tag_symlink, sizeof(tag_symlink), tags_dir, unescaped_filename, NULL);
r = symlink(device_node, tag_symlink);
if (r < 0 && errno != EEXIST) {
- log_error("failed to create symlink %s -> %s: %s\n", tag_symlink, device_node, strerror(errno));
+ log_error("failed to create symlink %s -> %s: %m\n", tag_symlink, device_node);
return -errno;
} else
r = 0;