void-packages/srcpkgs/elogind/files/007-fix-non_portable_percen...

1745 lines
74 KiB
Diff

--- src/cgroups-agent/cgroups-agent.c 2016-03-06 16:00:52.027398234 +0100
+++ src/cgroups-agent/cgroups-agent.c 2017-03-04 16:53:10.369345842 +0100
@@ -44,7 +44,7 @@
system bus. */
r = sd_bus_open_system(&bus);
if (r < 0) {
- log_debug_errno(r, "Failed to open system bus: %m");
+ log_debug_errno(r, "Failed to open system bus: %s", error_str());
return EXIT_FAILURE;
}
@@ -54,7 +54,7 @@
"Released",
"s", argv[1]);
if (r < 0) {
- log_debug_errno(r, "Failed to send signal message: %m");
+ log_debug_errno(r, "Failed to send signal message: %s", error_str());
return EXIT_FAILURE;
}
--- src/libelogind/sd-bus/bus-kernel.c 2015-04-19 13:32:24.607347468 +0200
+++ src/libelogind/sd-bus/bus-kernel.c 2017-03-04 16:53:10.410345905 +0100
@@ -1161,7 +1161,7 @@
/* Anybody can send us invalid messages, let's just drop them. */
if (r == -EBADMSG || r == -EPROTOTYPE)
- log_debug_errno(r, "Ignoring invalid synchronous reply: %m");
+ log_debug_errno(r, "Ignoring invalid synchronous reply: %s", error_str());
else
return r;
}
@@ -1369,7 +1369,7 @@
/* Anybody can send us invalid messages, let's just drop them. */
if (r == -EBADMSG || r == -EPROTOTYPE) {
- log_debug_errno(r, "Ignoring invalid message: %m");
+ log_debug_errno(r, "Ignoring invalid message: %s", error_str());
r = 0;
}
@@ -1765,14 +1765,14 @@
r = get_proc_cmdline_key("kdbus.attach_flags_mask=", &mask);
if (r < 0)
- return log_warning_errno(r, "Failed to read kernel command line: %m");
+ return log_warning_errno(r, "Failed to read kernel command line: %s", error_str());
if (r == 0) {
sprintf(buf, "0x%" PRIx64 "\n", m);
r = write_string_file("/sys/module/kdbus/parameters/attach_flags_mask", buf);
if (r < 0)
return log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
- "Failed to write kdbus attach mask: %m");
+ "Failed to write kdbus attach mask: %s", error_str());
}
return 0;
--- src/libelogind/sd-bus/bus-track.c 2015-04-19 13:32:24.611347468 +0200
+++ src/libelogind/sd-bus/bus-track.c 2017-03-04 16:53:10.415345912 +0100
@@ -308,7 +308,7 @@
r = track->handler(track, track->userdata);
if (r < 0)
- log_debug_errno(r, "Failed to process track handler: %m");
+ log_debug_errno(r, "Failed to process track handler: %s", error_str());
else if (r == 0)
bus_track_add_to_queue(track);
--- src/libelogind/sd-bus/bus-util.c 2017-03-04 16:54:39.916484983 +0100
+++ src/libelogind/sd-bus/bus-util.c 2017-03-04 16:53:10.425345927 +0100
@@ -1294,11 +1294,11 @@
#endif
int bus_log_parse_error(int r) {
- return log_error_errno(r, "Failed to parse bus message: %m");
+ return log_error_errno(r, "Failed to parse bus message: %s", error_str());
}
int bus_log_create_error(int r) {
- return log_error_errno(r, "Failed to create bus message: %m");
+ return log_error_errno(r, "Failed to create bus message: %s", error_str());
}
int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
@@ -1782,7 +1782,7 @@
q = bus_process_wait(d->bus);
if (q < 0)
- return log_error_errno(q, "Failed to wait for response: %m");
+ return log_error_errno(q, "Failed to wait for response: %s", error_str());
if (d->result) {
q = check_wait_response(d, quiet);
@@ -1791,7 +1791,7 @@
if (q < 0 && r == 0)
r = q;
- log_debug_errno(q, "Got result %s/%m for job %s", strna(d->result), strna(d->name));
+ log_debug_errno(q, "Got result %s/%s for job %s", strna(d->result), error_str(), strna(d->name));
}
free(d->name);
--- src/libelogind/sd-device/device-private.c 2015-04-19 13:32:24.611347468 +0200
+++ src/libelogind/sd-device/device-private.c 2017-03-04 16:53:10.363345832 +0100
@@ -381,43 +381,43 @@
/* the caller must verify or trust this data (e.g., if it comes from the kernel) */
r = device_set_syspath(device, path, false);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set syspath to '%s': %m", path);
+ return log_debug_errno(r, "sd-device: could not set syspath to '%s': %s", path, error_str());
} else if (streq(key, "SUBSYSTEM")) {
r = device_set_subsystem(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set subsystem to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set subsystem to '%s': %s", value, error_str());
} else if (streq(key, "DEVTYPE")) {
r = device_set_devtype(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devtype to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set devtype to '%s': %s", value, error_str());
} else if (streq(key, "DEVNAME")) {
r = device_set_devname(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devname to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set devname to '%s': %s", value, error_str());
} else if (streq(key, "USEC_INITIALIZED")) {
r = device_set_usec_initialized(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set usec-initialized to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set usec-initialized to '%s': %s", value, error_str());
} else if (streq(key, "DRIVER")) {
r = device_set_driver(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set driver to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set driver to '%s': %s", value, error_str());
} else if (streq(key, "IFINDEX")) {
r = device_set_ifindex(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set ifindex to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set ifindex to '%s': %s", value, error_str());
} else if (streq(key, "DEVMODE")) {
r = device_set_devmode(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devmode to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set devmode to '%s': %s", value, error_str());
} else if (streq(key, "DEVUID")) {
r = device_set_devuid(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devuid to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set devuid to '%s': %s", value, error_str());
} else if (streq(key, "DEVGID")) {
r = device_set_devgid(device, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devgid to '%s': %m", value);
+ return log_debug_errno(r, "sd-device: could not set devgid to '%s': %s", value, error_str());
} else if (streq(key, "DEVLINKS")) {
char *devlinks, *next;
@@ -428,7 +428,7 @@
r = device_add_devlink(device, devlinks);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not add devlink '%s': %m", devlinks);
+ return log_debug_errno(r, "sd-device: could not add devlink '%s': %s", devlinks, error_str());
devlinks = next + 1;
}
@@ -442,14 +442,14 @@
r = device_add_tag(device, tags);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not add tag '%s': %m", tags);
+ return log_debug_errno(r, "sd-device: could not add tag '%s': %s", tags, error_str());
tags = next + 1;
}
} else {
r = device_add_property_internal(device, key, value);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not add property '%s=%s': %m", key, value);
+ return log_debug_errno(r, "sd-device: could not add property '%s=%s': %s", key, value, error_str());
}
return 0;
@@ -572,7 +572,7 @@
if (major) {
r = device_set_devnum(device, major, minor);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %m", major, minor);
+ return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %s", major, minor, error_str());
}
r = device_verify(device, action, seqnum);
@@ -621,7 +621,7 @@
if (major) {
r = device_set_devnum(device, major, minor);
if (r < 0)
- return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %m", major, minor);
+ return log_debug_errno(r, "sd-device: could not set devnum %s:%s: %s", major, minor, error_str());
}
r = device_verify(device, action, seqnum);
--- src/libelogind/sd-device/sd-device.c 2017-03-04 16:54:39.917484985 +0100
+++ src/libelogind/sd-device/sd-device.c 2017-03-04 16:53:10.435345943 +0100
@@ -163,7 +163,7 @@
/* not a symlink */
syspath = canonicalize_file_name(_syspath);
if (!syspath) {
- log_debug("sd-device: could not canonicalize '%s': %m", _syspath);
+ log_debug("sd-device: could not canonicalize '%s': %s", _syspath, error_str());
return -errno;
}
/* ignore errors due to the link not being a symlink */
@@ -179,7 +179,7 @@
path = strjoina(syspath, "/uevent");
r = access(path, F_OK);
if (r < 0) {
- log_debug("sd-device: %s does not have an uevent file: %m", syspath);
+ log_debug("sd-device: %s does not have an uevent file: %s", syspath, error_str());
return -errno;
}
} else {
--- src/libelogind/sd-event/sd-event.c 2015-04-19 13:32:24.611347468 +0200
+++ src/libelogind/sd-event/sd-event.c 2017-03-04 16:53:10.448345963 +0100
@@ -2164,9 +2164,9 @@
if (r < 0) {
if (s->description)
- log_debug_errno(r, "Event source '%s' returned error, disabling: %m", s->description);
+ log_debug_errno(r, "Event source '%s' returned error, disabling: %s", s->description, error_str());
else
- log_debug_errno(r, "Event source %p returned error, disabling: %m", s);
+ log_debug_errno(r, "Event source %p returned error, disabling: %s", s, error_str());
}
if (s->n_ref == 0)
@@ -2202,9 +2202,9 @@
if (r < 0) {
if (s->description)
- log_debug_errno(r, "Prepare callback of event source '%s' returned error, disabling: %m", s->description);
+ log_debug_errno(r, "Prepare callback of event source '%s' returned error, disabling: %s", s->description, error_str());
else
- log_debug_errno(r, "Prepare callback of event source %p returned error, disabling: %m", s);
+ log_debug_errno(r, "Prepare callback of event source %p returned error, disabling: %s", s, error_str());
}
if (s->n_ref == 0)
--- src/libelogind/sd-rtnl/rtnl-util.c 2015-04-19 13:32:24.615347468 +0200
+++ src/libelogind/sd-rtnl/rtnl-util.c 2017-03-04 16:53:10.453345970 +0100
@@ -165,9 +165,9 @@
}
int rtnl_log_parse_error(int r) {
- return log_error_errno(r, "Failed to parse netlink message: %m");
+ return log_error_errno(r, "Failed to parse netlink message: %s", error_str());
}
int rtnl_log_create_error(int r) {
- return log_error_errno(r, "Failed to create netlink message: %m");
+ return log_error_errno(r, "Failed to create netlink message: %s", error_str());
}
--- src/libelogind/sd-rtnl/sd-rtnl.c 2015-04-19 13:32:24.615347468 +0200
+++ src/libelogind/sd-rtnl/sd-rtnl.c 2017-03-04 16:53:10.460345981 +0100
@@ -413,7 +413,7 @@
r = c->callback(rtnl, m, c->userdata);
if (r < 0)
- log_debug_errno(r, "sd-rtnl: timedout callback failed: %m");
+ log_debug_errno(r, "sd-rtnl: timedout callback failed: %s", error_str());
free(c);
@@ -446,7 +446,7 @@
r = c->callback(rtnl, m, c->userdata);
if (r < 0)
- log_debug_errno(r, "sd-rtnl: callback failed: %m");
+ log_debug_errno(r, "sd-rtnl: callback failed: %s", error_str());
return 1;
}
@@ -468,7 +468,7 @@
r = c->callback(rtnl, m, c->userdata);
if (r != 0) {
if (r < 0)
- log_debug_errno(r, "sd-rtnl: match callback failed: %m");
+ log_debug_errno(r, "sd-rtnl: match callback failed: %s", error_str());
break;
}
--- src/login/inhibit.c 2017-03-04 16:54:39.925484998 +0100
+++ src/login/inhibit.c 2017-03-04 16:53:10.430345935 +0100
@@ -235,7 +235,7 @@
r = sd_bus_default_system(&bus);
if (r < 0) {
- log_error_errno(r, "Failed to connect to bus: %m");
+ log_error_errno(r, "Failed to connect to bus: %s", error_str());
return EXIT_FAILURE;
}
@@ -266,7 +266,7 @@
pid = fork();
if (pid < 0) {
- log_error_errno(errno, "Failed to fork: %m");
+ log_error_errno(errno, "Failed to fork: %s", error_str());
return EXIT_FAILURE;
}
@@ -276,7 +276,7 @@
close_all_fds(NULL, 0);
execvp(argv[optind], argv + optind);
- log_error_errno(errno, "Failed to execute %s: %m", argv[optind]);
+ log_error_errno(errno, "Failed to execute %s: %s", argv[optind], error_str());
_exit(EXIT_FAILURE);
}
--- src/login/loginctl.c 2017-03-04 16:54:39.925484998 +0100
+++ src/login/loginctl.c 2017-03-04 16:53:10.484346018 +0100
@@ -408,7 +408,7 @@
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
if (r < 0)
- return log_error_errno(r, "Could not get properties: %m");
+ return log_error_errno(r, "Could not get properties: %s", error_str());
if (*new_line)
printf("\n");
@@ -537,7 +537,7 @@
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
if (r < 0) {
- log_error_errno(r, "Could not get properties: %m");
+ log_error_errno(r, "Could not get properties: %s", error_str());
goto finish;
}
@@ -615,7 +615,7 @@
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
if (r < 0) {
- log_error_errno(r, "Could not get properties: %m");
+ log_error_errno(r, "Could not get properties: %s", error_str());
goto finish;
}
@@ -670,7 +670,7 @@
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all);
if (r < 0)
- log_error_errno(r, "Could not get properties: %m");
+ log_error_errno(r, "Could not get properties: %s", error_str());
return r;
}
@@ -760,7 +760,7 @@
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
+ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str());
r = sd_bus_call_method(
bus,
@@ -954,7 +954,7 @@
else {
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
+ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str());
}
r = sd_bus_call_method(
@@ -989,7 +989,7 @@
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
+ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str());
r = sd_bus_call_method(
bus,
@@ -1026,7 +1026,7 @@
r = get_user_creds((const char**) (argv+i), &uid, NULL, NULL, NULL);
if (r < 0)
- return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
+ return log_error_errno(r, "Failed to look up user %s: %s", argv[i], error_str());
r = sd_bus_call_method(
bus,
@@ -1638,7 +1638,7 @@
r = bus_open_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
- log_error_errno(r, "Failed to create bus connection: %m");
+ log_error_errno(r, "Failed to create bus connection: %s", error_str());
goto finish;
}
--- src/login/logind-action.c 2017-03-04 16:54:39.909484972 +0100
+++ src/login/logind-action.c 2017-03-04 16:53:10.496346036 +0100
@@ -160,7 +160,7 @@
static int run_helper(const char *helper) {
int pid = fork();
if (pid < 0) {
- return log_error_errno(errno, "Failed to fork: %m");
+ return log_error_errno(errno, "Failed to fork: %s", error_str());
}
if (pid == 0) {
@@ -169,7 +169,7 @@
close_all_fds(NULL, 0);
execlp(helper, helper, NULL);
- log_error_errno(errno, "Failed to execute %s: %m", helper);
+ log_error_errno(errno, "Failed to execute %s: %s", helper, error_str());
_exit(EXIT_FAILURE);
}
@@ -187,14 +187,14 @@
if (k == 0)
return 0;
- log_debug_errno(k, "Failed to write '%s' to /sys/power/disk: %m",
- *mode);
+ log_debug_errno(k, "Failed to write '%s' to /sys/power/disk: %s",
+ *mode, error_str());
if (r == 0)
r = k;
}
if (r < 0)
- log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");
+ log_error_errno(r, "Failed to write mode to /sys/power/disk: %s", error_str());
return r;
}
@@ -209,15 +209,15 @@
k = write_string_stream(*f, *state);
if (k == 0)
return 0;
- log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m",
- *state);
+ log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %s",
+ *state, error_str());
if (r == 0)
r = k;
fclose(*f);
*f = fopen("/sys/power/state", "we");
if (!*f)
- return log_error_errno(errno, "Failed to open /sys/power/state: %m");
+ return log_error_errno(errno, "Failed to open /sys/power/state: %s", error_str());
}
return r;
@@ -238,7 +238,7 @@
* we can abort before modifying any state. */
f = fopen("/sys/power/state", "we");
if (!f)
- return log_error_errno(errno, "Failed to open /sys/power/state: %m");
+ return log_error_errno(errno, "Failed to open /sys/power/state: %s", error_str());
/* Configure the hibernation mode */
r = write_mode(modes);
--- src/login/logind-button.c 2015-04-19 13:32:24.639347469 +0200
+++ src/login/logind-button.c 2017-03-04 16:53:10.490346027 +0100
@@ -248,17 +248,17 @@
b->fd = open(p, O_RDWR|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
if (b->fd < 0)
- return log_warning_errno(errno, "Failed to open %s: %m", b->name);
+ return log_warning_errno(errno, "Failed to open %s: %s", b->name, error_str());
if (ioctl(b->fd, EVIOCGNAME(sizeof(name)), name) < 0) {
- log_error_errno(errno, "Failed to get input name: %m");
+ log_error_errno(errno, "Failed to get input name: %s", error_str());
r = -errno;
goto fail;
}
r = sd_event_add_io(b->manager->event, &b->io_event_source, b->fd, EPOLLIN, button_dispatch, b);
if (r < 0) {
- log_error_errno(r, "Failed to add button event: %m");
+ log_error_errno(r, "Failed to add button event: %s", error_str());
goto fail;
}
--- src/login/logind-core.c 2016-03-06 16:00:52.027398234 +0100
+++ src/login/logind-core.c 2017-03-04 16:53:10.502346045 +0100
@@ -500,7 +500,7 @@
* assume that we are docked. */
n = manager_count_displays(m);
if (n < 0)
- log_warning_errno(n, "Display counting failed: %m");
+ log_warning_errno(n, "Display counting failed: %s", error_str());
else if (n > 1) {
log_debug("Multiple (%i) displays connected.", n);
return true;
--- src/login/logind-dbus.c 2016-03-17 09:22:03.403779113 +0100
+++ src/login/logind-dbus.c 2017-03-04 16:53:10.510346058 +0100
@@ -1217,7 +1217,7 @@
d = opendir("/etc/udev/rules.d");
if (!d) {
if (errno != ENOENT)
- log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %m");
+ log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %s", error_str());
} else {
struct dirent *de;
@@ -1233,7 +1233,7 @@
continue;
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
- log_warning_errno(errno, "Failed to unlink %s: %m", de->d_name);
+ log_warning_errno(errno, "Failed to unlink %s: %s", de->d_name, error_str());
}
}
--- src/login/logind-inhibit.c 2015-04-19 13:32:24.643347470 +0200
+++ src/login/logind-inhibit.c 2017-03-04 16:53:10.466345990 +0100
@@ -137,7 +137,7 @@
finish:
if (r < 0)
- log_error_errno(r, "Failed to save inhibit data %s: %m", i->state_file);
+ log_error_errno(r, "Failed to save inhibit data %s: %s", i->state_file, error_str());
return r;
}
--- src/login/logind-seat.c 2015-08-23 11:10:58.890333172 +0200
+++ src/login/logind-seat.c 2017-03-04 16:53:10.515346065 +0100
@@ -149,7 +149,7 @@
finish:
if (r < 0)
- log_error_errno(r, "Failed to save seat data %s: %m", s->state_file);
+ log_error_errno(r, "Failed to save seat data %s: %s", s->state_file, error_str());
return r;
}
@@ -188,7 +188,7 @@
!!s->active, s->active ? s->active->user->uid : 0);
if (r < 0)
- log_error_errno(r, "Failed to apply ACLs: %m");
+ log_error_errno(r, "Failed to apply ACLs: %s", error_str());
return r;
}
--- src/login/logind-session.c 2016-03-06 16:00:52.103398185 +0100
+++ src/login/logind-session.c 2017-03-04 16:53:10.474346002 +0100
@@ -278,7 +278,7 @@
finish:
if (r < 0)
- log_error_errno(r, "Failed to save session data %s: %m", s->state_file);
+ log_error_errno(r, "Failed to save session data %s: %s", s->state_file, error_str());
return r;
}
@@ -324,7 +324,7 @@
NULL);
if (r < 0)
- return log_error_errno(r, "Failed to read %s: %m", s->state_file);
+ return log_error_errno(r, "Failed to read %s: %s", s->state_file, error_str());
if (!s->user) {
uid_t u;
@@ -487,11 +487,11 @@
/* First, create our own group */
r = cg_create(SYSTEMD_CGROUP_CONTROLLER, s->id);
if (r < 0)
- return log_error_errno(r, "Failed to create cgroup %s: %m", s->id);
+ return log_error_errno(r, "Failed to create cgroup %s: %s", s->id, error_str());
r = cg_attach(SYSTEMD_CGROUP_CONTROLLER, s->id, s->leader);
if (r < 0)
- log_warning_errno(r, "Failed to attach PID %d to cgroup %s: %m", s->leader, s->id);
+ log_warning_errno(r, "Failed to attach PID %d to cgroup %s: %s", s->leader, s->id, error_str());
return 0;
}
@@ -899,7 +899,7 @@
/* FIXME: verify that leader is in cgroup? */
if (kill(s->leader, signo) < 0) {
- return log_error_errno(errno, "Failed to kill process leader %d for session %s: %m", s->leader, s->id);
+ return log_error_errno(errno, "Failed to kill process leader %d for session %s: %s", s->leader, s->id, error_str());
}
return 0;
} else {
@@ -923,7 +923,7 @@
sprintf(path, "/dev/tty%u", s->vtnr);
s->vtfd = open(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
if (s->vtfd < 0)
- return log_error_errno(errno, "cannot open VT %s of session %s: %m", path, s->id);
+ return log_error_errno(errno, "cannot open VT %s of session %s: %s", path, s->id, error_str());
return s->vtfd;
}
@@ -942,21 +942,21 @@
r = fchown(vt, s->user->uid, -1);
if (r < 0) {
r = -errno;
- log_error_errno(errno, "Cannot change owner of /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot change owner of /dev/tty%u: %s", s->vtnr, error_str());
goto error;
}
r = ioctl(vt, KDSKBMODE, K_OFF);
if (r < 0) {
r = -errno;
- log_error_errno(errno, "Cannot set K_OFF on /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot set K_OFF on /dev/tty%u: %s", s->vtnr, error_str());
goto error;
}
r = ioctl(vt, KDSETMODE, KD_GRAPHICS);
if (r < 0) {
r = -errno;
- log_error_errno(errno, "Cannot set KD_GRAPHICS on /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot set KD_GRAPHICS on /dev/tty%u: %s", s->vtnr, error_str());
goto error;
}
@@ -969,7 +969,7 @@
r = ioctl(vt, VT_SETMODE, &mode);
if (r < 0) {
r = -errno;
- log_error_errno(errno, "Cannot set VT_PROCESS on /dev/tty%u: %m", s->vtnr);
+ log_error_errno(errno, "Cannot set VT_PROCESS on /dev/tty%u: %s", s->vtnr, error_str());
goto error;
}
@@ -1026,7 +1026,7 @@
session_device_pause_all(s);
r = ioctl(s->vtfd, VT_RELDISP, 1);
if (r < 0)
- log_debug_errno(errno, "Cannot release VT of session %s: %m", s->id);
+ log_debug_errno(errno, "Cannot release VT of session %s: %s", s->id, error_str());
}
bool session_is_controller(Session *s, const char *sender) {
--- src/login/logind-user.c 2016-03-06 16:00:52.031398232 +0100
+++ src/login/logind-user.c 2017-03-04 16:53:10.529346087 +0100
@@ -228,7 +228,7 @@
finish:
if (r < 0)
- log_error_errno(r, "Failed to save user data %s: %m", u->state_file);
+ log_error_errno(r, "Failed to save user data %s: %s", u->state_file, error_str());
return r;
}
@@ -250,7 +250,7 @@
if (r == -ENOENT)
return 0;
- log_error_errno(r, "Failed to read %s: %m", u->state_file);
+ log_error_errno(r, "Failed to read %s: %s", u->state_file, error_str());
return r;
}
@@ -283,7 +283,7 @@
r = mkdir_safe_label("/run/user", 0755, 0, 0);
if (r < 0)
- return log_error_errno(r, "Failed to create /run/user: %m");
+ return log_error_errno(r, "Failed to create /run/user: %s", error_str());
if (!u->runtime_path) {
if (asprintf(&p, "/run/user/" UID_FMT, u->uid) < 0)
@@ -308,7 +308,7 @@
r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t);
if (r < 0) {
if (errno != EPERM) {
- r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %m", p);
+ r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %s", p, error_str());
goto fail;
}
@@ -318,7 +318,7 @@
r = chmod_and_chown(p, 0700, u->uid, u->gid);
if (r < 0) {
- log_error_errno(r, "Failed to change runtime directory ownership and mode: %m");
+ log_error_errno(r, "Failed to change runtime directory ownership and mode: %s", error_str());
goto fail;
}
}
@@ -376,18 +376,18 @@
r = rm_rf(u->runtime_path, false, false, false);
if (r < 0)
- log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
+ log_error_errno(r, "Failed to remove runtime directory %s: %s", u->runtime_path, error_str());
/* Ignore cases where the directory isn't mounted, as that's
* quite possible, if we lacked the permissions to mount
* something */
r = umount2(u->runtime_path, MNT_DETACH);
if (r < 0 && errno != EINVAL && errno != ENOENT)
- log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", u->runtime_path);
+ log_error_errno(errno, "Failed to unmount user runtime directory %s: %s", u->runtime_path, error_str());
r = rm_rf(u->runtime_path, false, true, false);
if (r < 0)
- log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
+ log_error_errno(r, "Failed to remove runtime directory %s: %s", u->runtime_path, error_str());
free(u->runtime_path);
u->runtime_path = NULL;
--- src/login/logind.c 2016-03-06 16:00:52.031398232 +0100
+++ src/login/logind.c 2017-03-04 16:53:10.399345888 +0100
@@ -302,7 +302,7 @@
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Failed to open /run/systemd/seats: %m");
+ log_error_errno(errno, "Failed to open /run/systemd/seats: %s", error_str());
return -errno;
}
@@ -339,7 +339,7 @@
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Failed to open /var/lib/systemd/linger/: %m");
+ log_error_errno(errno, "Failed to open /var/lib/systemd/linger/: %s", error_str());
return -errno;
}
@@ -351,7 +351,7 @@
k = manager_add_user_by_name(m, de->d_name, NULL);
if (k < 0) {
- log_notice_errno(k, "Couldn't add lingering user %s: %m", de->d_name);
+ log_notice_errno(k, "Couldn't add lingering user %s: %s", de->d_name, error_str());
r = k;
}
}
@@ -375,7 +375,7 @@
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Failed to open /run/systemd/users: %m");
+ log_error_errno(errno, "Failed to open /run/systemd/users: %s", error_str());
return -errno;
}
@@ -387,7 +387,7 @@
k = manager_add_user_by_name(m, de->d_name, &u);
if (k < 0) {
- log_error_errno(k, "Failed to add user by file name %s: %m", de->d_name);
+ log_error_errno(k, "Failed to add user by file name %s: %s", de->d_name, error_str());
r = k;
continue;
@@ -416,7 +416,7 @@
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Failed to open /run/systemd/sessions: %m");
+ log_error_errno(errno, "Failed to open /run/systemd/sessions: %s", error_str());
return -errno;
}
@@ -435,7 +435,7 @@
k = manager_add_session(m, de->d_name, &s);
if (k < 0) {
- log_error_errno(k, "Failed to add session by file name %s: %m", de->d_name);
+ log_error_errno(k, "Failed to add session by file name %s: %s", de->d_name, error_str());
r = k;
continue;
@@ -463,7 +463,7 @@
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Failed to open /run/systemd/inhibit: %m");
+ log_error_errno(errno, "Failed to open /run/systemd/inhibit: %s", error_str());
return -errno;
}
@@ -476,7 +476,7 @@
k = manager_add_inhibitor(m, de->d_name, &i);
if (k < 0) {
- log_notice_errno(k, "Couldn't add inhibitor %s: %m", de->d_name);
+ log_notice_errno(k, "Couldn't add inhibitor %s: %s", de->d_name, error_str());
r = k;
continue;
}
@@ -580,11 +580,11 @@
r = sd_bus_default_system(&m->bus);
if (r < 0)
- return log_error_errno(r, "Failed to connect to system bus: %m");
+ return log_error_errno(r, "Failed to connect to system bus: %s", error_str());
r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/login1", "org.freedesktop.login1.Manager", manager_vtable, m);
if (r < 0)
- return log_error_errno(r, "Failed to add manager object vtable: %m");
+ return log_error_errno(r, "Failed to add manager object vtable: %s", error_str());
r = sd_bus_add_match(m->bus, NULL,
"type='signal',"
@@ -595,35 +595,35 @@
r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/seat", "org.freedesktop.login1.Seat", seat_vtable, seat_object_find, m);
if (r < 0)
- return log_error_errno(r, "Failed to add seat object vtable: %m");
+ return log_error_errno(r, "Failed to add seat object vtable: %s", error_str());
r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/seat", seat_node_enumerator, m);
if (r < 0)
- return log_error_errno(r, "Failed to add seat enumerator: %m");
+ return log_error_errno(r, "Failed to add seat enumerator: %s", error_str());
r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/session", "org.freedesktop.login1.Session", session_vtable, session_object_find, m);
if (r < 0)
- return log_error_errno(r, "Failed to add session object vtable: %m");
+ return log_error_errno(r, "Failed to add session object vtable: %s", error_str());
r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/session", session_node_enumerator, m);
if (r < 0)
- return log_error_errno(r, "Failed to add session enumerator: %m");
+ return log_error_errno(r, "Failed to add session enumerator: %s", error_str());
r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/user", "org.freedesktop.login1.User", user_vtable, user_object_find, m);
if (r < 0)
- return log_error_errno(r, "Failed to add user object vtable: %m");
+ return log_error_errno(r, "Failed to add user object vtable: %s", error_str());
r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/user", user_node_enumerator, m);
if (r < 0)
- return log_error_errno(r, "Failed to add user enumerator: %m");
+ return log_error_errno(r, "Failed to add user enumerator: %s", error_str());
r = sd_bus_request_name(m->bus, "org.freedesktop.login1", 0);
if (r < 0)
- return log_error_errno(r, "Failed to register name: %m");
+ return log_error_errno(r, "Failed to register name: %s", error_str());
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
- return log_error_errno(r, "Failed to attach bus to event loop: %m");
+ return log_error_errno(r, "Failed to attach bus to event loop: %s", error_str());
return 0;
}
@@ -681,7 +681,7 @@
r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &m->cgroup_root);
if (r < 0)
- return log_error_errno(r, "Cannot determine cgroup we are running in: %m");
+ return log_error_errno(r, "Cannot determine cgroup we are running in: %s", error_str());
/* Make sure to store away the root value without trailing
* slash, even for the root dir, so that we can easily prepend
@@ -692,14 +692,14 @@
/* 2. Show data */
r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, NULL, &path);
if (r < 0)
- return log_error_errno(r, "Cannot find cgroup mount point: %m");
+ return log_error_errno(r, "Cannot find cgroup mount point: %s", error_str());
log_debug("Using cgroup controller " SYSTEMD_CGROUP_CONTROLLER ". File system hierarchy is at %s.", path);
/* 3. Install agent */
r = cg_install_release_agent(SYSTEMD_CGROUP_CONTROLLER, SYSTEMD_CGROUP_AGENT_PATH);
if (r < 0)
- log_warning_errno(r, "Failed to install release agent, ignoring: %m");
+ log_warning_errno(r, "Failed to install release agent, ignoring: %s", error_str());
else if (r > 0)
log_debug("Installed release agent.");
else
@@ -708,14 +708,14 @@
/* 4. Make sure we are in the root cgroup */
r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0);
if (r < 0)
- return log_error_errno(r, "Failed to create root cgroup hierarchy: %m");
+ return log_error_errno(r, "Failed to create root cgroup hierarchy: %s", error_str());
/* 5. And pin it, so that it cannot be unmounted */
safe_close(m->pin_cgroupfs_fd);
m->pin_cgroupfs_fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY|O_NONBLOCK);
if (m->pin_cgroupfs_fd < 0)
- return log_error_errno(errno, "Failed to open pin file: %m");
+ return log_error_errno(errno, "Failed to open pin file: %s", error_str());
return 0;
}
@@ -740,7 +740,7 @@
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Failed to open /sys/class/tty/tty0/active: %m");
+ log_error_errno(errno, "Failed to open /sys/class/tty/tty0/active: %s", error_str());
return -errno;
}
@@ -764,11 +764,11 @@
r = ignore_signals(SIGRTMIN + 1, -1);
if (r < 0)
- return log_error_errno(r, "Cannot ignore SIGRTMIN + 1: %m");
+ return log_error_errno(r, "Cannot ignore SIGRTMIN + 1: %s", error_str());
r = sigprocmask_many(SIG_BLOCK, SIGRTMIN, -1);
if (r < 0)
- return log_error_errno(r, "Cannot block SIGRTMIN: %m");
+ return log_error_errno(r, "Cannot block SIGRTMIN: %s", error_str());
r = sd_event_add_signal(m->event, NULL, SIGRTMIN, manager_vt_switch, m);
if (r < 0)
@@ -950,19 +950,19 @@
elapse, USEC_PER_SEC*30,
manager_dispatch_idle_action, m);
if (r < 0)
- return log_error_errno(r, "Failed to add idle event source: %m");
+ return log_error_errno(r, "Failed to add idle event source: %s", error_str());
r = sd_event_source_set_priority(m->idle_action_event_source, SD_EVENT_PRIORITY_IDLE+10);
if (r < 0)
- return log_error_errno(r, "Failed to set idle event source priority: %m");
+ return log_error_errno(r, "Failed to set idle event source priority: %s", error_str());
} else {
r = sd_event_source_set_time(m->idle_action_event_source, elapse);
if (r < 0)
- return log_error_errno(r, "Failed to set idle event timer: %m");
+ return log_error_errno(r, "Failed to set idle event timer: %s", error_str());
r = sd_event_source_set_enabled(m->idle_action_event_source, SD_EVENT_ONESHOT);
if (r < 0)
- return log_error_errno(r, "Failed to enable idle event timer: %m");
+ return log_error_errno(r, "Failed to enable idle event timer: %s", error_str());
}
return 0;
@@ -992,7 +992,7 @@
/* Connect to udev */
r = manager_connect_udev(m);
if (r < 0)
- return log_error_errno(r, "Failed to create udev watchers: %m");
+ return log_error_errno(r, "Failed to create udev watchers: %s", error_str());
/* Connect to the bus */
r = manager_connect_bus(m);
@@ -1002,36 +1002,36 @@
/* Instantiate magic seat 0 */
r = manager_add_seat(m, "seat0", &m->seat0);
if (r < 0)
- return log_error_errno(r, "Failed to add seat0: %m");
+ return log_error_errno(r, "Failed to add seat0: %s", error_str());
r = manager_set_lid_switch_ignore(m, 0 + m->holdoff_timeout_usec);
if (r < 0)
- log_warning_errno(r, "Failed to set up lid switch ignore event source: %m");
+ log_warning_errno(r, "Failed to set up lid switch ignore event source: %s", error_str());
/* Deserialize state */
r = manager_enumerate_devices(m);
if (r < 0)
- log_warning_errno(r, "Device enumeration failed: %m");
+ log_warning_errno(r, "Device enumeration failed: %s", error_str());
r = manager_enumerate_seats(m);
if (r < 0)
- log_warning_errno(r, "Seat enumeration failed: %m");
+ log_warning_errno(r, "Seat enumeration failed: %s", error_str());
r = manager_enumerate_users(m);
if (r < 0)
- log_warning_errno(r, "User enumeration failed: %m");
+ log_warning_errno(r, "User enumeration failed: %s", error_str());
r = manager_enumerate_sessions(m);
if (r < 0)
- log_warning_errno(r, "Session enumeration failed: %m");
+ log_warning_errno(r, "Session enumeration failed: %s", error_str());
r = manager_enumerate_inhibitors(m);
if (r < 0)
- log_warning_errno(r, "Inhibitor enumeration failed: %m");
+ log_warning_errno(r, "Inhibitor enumeration failed: %s", error_str());
r = manager_enumerate_buttons(m);
if (r < 0)
- log_warning_errno(r, "Button enumeration failed: %m");
+ log_warning_errno(r, "Button enumeration failed: %s", error_str());
/* Remove stale objects before we start them */
manager_gc(m, false);
@@ -1150,7 +1150,7 @@
r = manager_startup(m);
if (r < 0) {
- log_error_errno(r, "Failed to fully start up daemon: %m");
+ log_error_errno(r, "Failed to fully start up daemon: %s", error_str());
goto finish;
}
--- src/login/pam_elogind.c 2015-08-15 22:14:07.531421465 +0200
+++ src/login/pam_elogind.c 2017-03-04 16:53:10.534346094 +0100
@@ -473,7 +473,7 @@
if (session_fd >= 0) {
session_fd = fcntl(session_fd, F_DUPFD_CLOEXEC, 3);
if (session_fd < 0) {
- pam_syslog(handle, LOG_ERR, "Failed to dup session fd: %m");
+ pam_syslog(handle, LOG_ERR, "Failed to dup session fd: %s", error_str());
return PAM_SESSION_ERR;
}
--- src/shared/base-filesystem.c 2015-04-19 13:32:24.655347470 +0200
+++ src/shared/base-filesystem.c 2017-03-04 16:53:10.541346105 +0100
@@ -54,7 +54,7 @@
fd = open(root, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
if (fd < 0)
- return log_error_errno(errno, "Failed to open root file system: %m");
+ return log_error_errno(errno, "Failed to open root file system: %s", error_str());
for (i = 0; i < ELEMENTSOF(table); i ++) {
if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
@@ -89,14 +89,14 @@
r = symlinkat(target, fd, table[i].dir);
if (r < 0 && errno != EEXIST)
- return log_error_errno(errno, "Failed to create symlink at %s/%s: %m", root, table[i].dir);
+ return log_error_errno(errno, "Failed to create symlink at %s/%s: %s", root, table[i].dir, error_str());
continue;
}
RUN_WITH_UMASK(0000)
r = mkdirat(fd, table[i].dir, table[i].mode);
if (r < 0 && errno != EEXIST)
- return log_error_errno(errno, "Failed to create directory at %s/%s: %m", root, table[i].dir);
+ return log_error_errno(errno, "Failed to create directory at %s/%s: %s", root, table[i].dir, error_str());
}
return 0;
--- src/shared/capability.c 2015-04-19 13:32:24.655347470 +0200
+++ src/shared/capability.c 2017-03-04 16:53:10.525346081 +0100
@@ -237,26 +237,26 @@
* which we want to avoid. */
if (setresgid(gid, gid, gid) < 0)
- return log_error_errno(errno, "Failed to change group ID: %m");
+ return log_error_errno(errno, "Failed to change group ID: %s", error_str());
if (setgroups(0, NULL) < 0)
- return log_error_errno(errno, "Failed to drop auxiliary groups list: %m");
+ return log_error_errno(errno, "Failed to drop auxiliary groups list: %s", error_str());
/* Ensure we keep the permitted caps across the setresuid() */
if (prctl(PR_SET_KEEPCAPS, 1) < 0)
- return log_error_errno(errno, "Failed to enable keep capabilities flag: %m");
+ return log_error_errno(errno, "Failed to enable keep capabilities flag: %s", error_str());
r = setresuid(uid, uid, uid);
if (r < 0)
- return log_error_errno(errno, "Failed to change user ID: %m");
+ return log_error_errno(errno, "Failed to change user ID: %s", error_str());
if (prctl(PR_SET_KEEPCAPS, 0) < 0)
- return log_error_errno(errno, "Failed to disable keep capabilities flag: %m");
+ return log_error_errno(errno, "Failed to disable keep capabilities flag: %s", error_str());
/* Drop all caps from the bounding set, except the ones we want */
r = capability_bounding_set_drop(~keep_capabilities, true);
if (r < 0)
- return log_error_errno(r, "Failed to drop capabilities: %m");
+ return log_error_errno(r, "Failed to drop capabilities: %s", error_str());
/* Now upgrade the permitted caps we still kept to effective caps */
d = cap_init();
@@ -277,12 +277,12 @@
if (cap_set_flag(d, CAP_EFFECTIVE, j, bits, CAP_SET) < 0 ||
cap_set_flag(d, CAP_PERMITTED, j, bits, CAP_SET) < 0) {
- log_error_errno(errno, "Failed to enable capabilities bits: %m");
+ log_error_errno(errno, "Failed to enable capabilities bits: %s", error_str());
return -errno;
}
if (cap_set_proc(d) < 0)
- return log_error_errno(errno, "Failed to increase capabilities: %m");
+ return log_error_errno(errno, "Failed to increase capabilities: %s", error_str());
}
return 0;
--- src/shared/clean-ipc.c 2015-04-19 13:32:24.655347470 +0200
+++ src/shared/clean-ipc.c 2017-03-04 16:53:10.545346111 +0100
@@ -43,7 +43,7 @@
if (errno == ENOENT)
return 0;
- log_warning_errno(errno, "Failed to open /proc/sysvipc/shm: %m");
+ log_warning_errno(errno, "Failed to open /proc/sysvipc/shm: %s", error_str());
return -errno;
}
@@ -77,7 +77,7 @@
if (errno == EIDRM || errno == EINVAL)
continue;
- log_warning_errno(errno, "Failed to remove SysV shared memory segment %i: %m", shmid);
+ log_warning_errno(errno, "Failed to remove SysV shared memory segment %i: %s", shmid, error_str());
ret = -errno;
}
}
@@ -85,7 +85,7 @@
return ret;
fail:
- log_warning_errno(errno, "Failed to read /proc/sysvipc/shm: %m");
+ log_warning_errno(errno, "Failed to read /proc/sysvipc/shm: %s", error_str());
return -errno;
}
@@ -100,7 +100,7 @@
if (errno == ENOENT)
return 0;
- log_warning_errno(errno, "Failed to open /proc/sysvipc/sem: %m");
+ log_warning_errno(errno, "Failed to open /proc/sysvipc/sem: %s", error_str());
return -errno;
}
@@ -129,7 +129,7 @@
if (errno == EIDRM || errno == EINVAL)
continue;
- log_warning_errno(errno, "Failed to remove SysV semaphores object %i: %m", semid);
+ log_warning_errno(errno, "Failed to remove SysV semaphores object %i: %s", semid, error_str());
ret = -errno;
}
}
@@ -137,7 +137,7 @@
return ret;
fail:
- log_warning_errno(errno, "Failed to read /proc/sysvipc/sem: %m");
+ log_warning_errno(errno, "Failed to read /proc/sysvipc/sem: %s", error_str());
return -errno;
}
@@ -152,7 +152,7 @@
if (errno == ENOENT)
return 0;
- log_warning_errno(errno, "Failed to open /proc/sysvipc/msg: %m");
+ log_warning_errno(errno, "Failed to open /proc/sysvipc/msg: %s", error_str());
return -errno;
}
@@ -182,7 +182,7 @@
if (errno == EIDRM || errno == EINVAL)
continue;
- log_warning_errno(errno, "Failed to remove SysV message queue %i: %m", msgid);
+ log_warning_errno(errno, "Failed to remove SysV message queue %i: %s", msgid, error_str());
ret = -errno;
}
}
@@ -190,7 +190,7 @@
return ret;
fail:
- log_warning_errno(errno, "Failed to read /proc/sysvipc/msg: %m");
+ log_warning_errno(errno, "Failed to read /proc/sysvipc/msg: %s", error_str());
return -errno;
}
@@ -210,7 +210,7 @@
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %m", de->d_name);
+ log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %s", de->d_name, error_str());
ret = -errno;
continue;
}
@@ -224,7 +224,7 @@
kid = xopendirat(dirfd(dir), de->d_name, O_NOFOLLOW|O_NOATIME);
if (!kid) {
if (errno != ENOENT) {
- log_warning_errno(errno, "Failed to enter shared memory directory %s: %m", de->d_name);
+ log_warning_errno(errno, "Failed to enter shared memory directory %s: %s", de->d_name, error_str());
ret = -errno;
}
} else {
@@ -238,7 +238,7 @@
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %m", de->d_name);
+ log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %s", de->d_name, error_str());
ret = -errno;
}
} else {
@@ -248,7 +248,7 @@
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %m", de->d_name);
+ log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %s", de->d_name, error_str());
ret = -errno;
}
}
@@ -257,7 +257,7 @@
return ret;
fail:
- log_warning_errno(errno, "Failed to read /dev/shm: %m");
+ log_warning_errno(errno, "Failed to read /dev/shm: %s", error_str());
return -errno;
}
@@ -269,7 +269,7 @@
if (errno == ENOENT)
return 0;
- log_warning_errno(errno, "Failed to open /dev/shm: %m");
+ log_warning_errno(errno, "Failed to open /dev/shm: %s", error_str());
return -errno;
}
@@ -286,7 +286,7 @@
if (errno == ENOENT)
return 0;
- log_warning_errno(errno, "Failed to open /dev/mqueue: %m");
+ log_warning_errno(errno, "Failed to open /dev/mqueue: %s", error_str());
return -errno;
}
@@ -301,7 +301,7 @@
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to stat() MQ segment %s: %m", de->d_name);
+ log_warning_errno(errno, "Failed to stat() MQ segment %s: %s", de->d_name, error_str());
ret = -errno;
continue;
}
@@ -316,7 +316,7 @@
if (errno == ENOENT)
continue;
- log_warning_errno(errno, "Failed to unlink POSIX message queue %s: %m", fn);
+ log_warning_errno(errno, "Failed to unlink POSIX message queue %s: %s", fn, error_str());
ret = -errno;
}
}
@@ -324,7 +324,7 @@
return ret;
fail:
- log_warning_errno(errno, "Failed to read /dev/mqueue: %m");
+ log_warning_errno(errno, "Failed to read /dev/mqueue: %s", error_str());
return -errno;
}
--- src/shared/conf-files.c 2015-04-19 13:32:24.655347470 +0200
+++ src/shared/conf-files.c 2017-03-04 16:53:10.551346120 +0100
@@ -115,8 +115,8 @@
if (r == -ENOMEM) {
return r;
} else if (r < 0)
- log_debug_errno(r, "Failed to search for files in %s: %m",
- *p);
+ log_debug_errno(r, "Failed to search for files in %s: %s",
+ *p, error_str());
}
files = hashmap_get_strv(fh);
--- src/shared/conf-parser.c 2015-04-19 13:32:24.655347470 +0200
+++ src/shared/conf-parser.c 2017-03-04 16:53:10.557346130 +0100
@@ -348,7 +348,7 @@
* since we return 0 to the caller. */
if (warn || errno == ENOENT)
log_full(errno == ENOENT ? LOG_DEBUG : LOG_ERR,
- "Failed to open configuration file '%s': %m", filename);
+ "Failed to open configuration file '%s': %s", filename, error_str());
return errno == ENOENT ? 0 : -errno;
}
}
@@ -363,7 +363,7 @@
if (feof(f))
break;
- log_error_errno(errno, "Failed to read configuration file '%s': %m", filename);
+ log_error_errno(errno, "Failed to read configuration file '%s': %s", filename, error_str());
return -errno;
}
@@ -424,8 +424,8 @@
if (r < 0) {
if (warn)
- log_warning_errno(r, "Failed to parse file '%s': %m",
- filename);
+ log_warning_errno(r, "Failed to parse file '%s': %s",
+ filename, error_str());
return r;
}
}
--- src/shared/log.c 2017-03-04 16:54:39.918484986 +0100
+++ src/shared/log.c 2017-03-04 16:53:39.829390976 +0100
@@ -1066,3 +1066,15 @@
void log_set_upgrade_syslog_to_journal(bool b) {
upgrade_syslog_to_journal = b;
}
+
+const char* error_str(void) {
+ static __thread char msg[512];
+ int error = errno;
+ int res = strerror_r(error, msg, sizeof(msg));
+ if (res < 0)
+ snprintf(msg, sizeof(msg), "strerror_r(%d,%p,%d) failed", error, msg, (int)sizeof(msg));
+ /* Make sure to restore the previous error */
+ if (error != 0)
+ errno = error;
+ return msg;
+}
--- src/shared/log.h 2015-04-19 13:32:24.659347470 +0200
+++ src/shared/log.h 2017-03-04 16:53:16.547355307 +0100
@@ -209,3 +209,5 @@
void log_received_signal(int level, const struct signalfd_siginfo *si);
void log_set_upgrade_syslog_to_journal(bool b);
+
+const char* error_str(void);
--- src/shared/pager.c 2017-03-04 16:54:39.918484986 +0100
+++ src/shared/pager.c 2017-03-04 16:53:10.375345851 +0100
@@ -40,7 +40,7 @@
} while (n > 0);
if (n < 0) {
- log_error_errno(errno, "Internal pager failed: %m");
+ log_error_errno(errno, "Internal pager failed: %s", error_str());
_exit(EXIT_FAILURE);
}
@@ -68,14 +68,14 @@
columns();
if (pipe(fd) < 0)
- return log_error_errno(errno, "Failed to create pager pipe: %m");
+ return log_error_errno(errno, "Failed to create pager pipe: %s", error_str());
parent_pid = getpid();
pager_pid = fork();
if (pager_pid < 0) {
r = -errno;
- log_error_errno(errno, "Failed to fork pager: %m");
+ log_error_errno(errno, "Failed to fork pager: %s", error_str());
safe_close_pair(fd);
return r;
}
@@ -125,7 +125,7 @@
/* Return in the parent */
if (dup2(fd[1], STDOUT_FILENO) < 0)
- return log_error_errno(errno, "Failed to duplicate pager pipe: %m");
+ return log_error_errno(errno, "Failed to duplicate pager pipe: %s", error_str());
safe_close_pair(fd);
return 1;
@@ -173,20 +173,20 @@
pid = fork();
if (pid < 0)
- return log_error_errno(errno, "Failed to fork: %m");
+ return log_error_errno(errno, "Failed to fork: %s", error_str());
if (pid == 0) {
/* Child */
if (null_stdio) {
r = make_null_stdio();
if (r < 0) {
- log_error_errno(r, "Failed to kill stdio: %m");
+ log_error_errno(r, "Failed to kill stdio: %s", error_str());
_exit(EXIT_FAILURE);
}
}
execvp(args[0], (char**) args);
- log_error_errno(errno, "Failed to execute man: %m");
+ log_error_errno(errno, "Failed to execute man: %s", error_str());
_exit(EXIT_FAILURE);
}
--- src/shared/ptyfwd.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/ptyfwd.c 2017-03-04 16:53:10.538346100 +0100
@@ -123,7 +123,7 @@
f->stdin_event_source = sd_event_source_unref(f->stdin_event_source);
} else {
- log_error_errno(errno, "read(): %m");
+ log_error_errno(errno, "read(): %s", error_str());
return sd_event_exit(f->event, EXIT_FAILURE);
}
} else if (k == 0) {
@@ -157,7 +157,7 @@
f->master_event_source = sd_event_source_unref(f->master_event_source);
} else {
- log_error_errno(errno, "write(): %m");
+ log_error_errno(errno, "write(): %s", error_str());
return sd_event_exit(f->event, EXIT_FAILURE);
}
} else {
@@ -187,7 +187,7 @@
f->master_event_source = sd_event_source_unref(f->master_event_source);
} else {
- log_error_errno(errno, "read(): %m");
+ log_error_errno(errno, "read(): %s", error_str());
return sd_event_exit(f->event, EXIT_FAILURE);
}
} else
@@ -206,7 +206,7 @@
f->stdout_hangup = true;
f->stdout_event_source = sd_event_source_unref(f->stdout_event_source);
} else {
- log_error_errno(errno, "write(): %m");
+ log_error_errno(errno, "write(): %s", error_str());
return sd_event_exit(f->event, EXIT_FAILURE);
}
--- src/shared/selinux-util.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/selinux-util.c 2017-03-04 16:53:10.519346071 +0100
@@ -89,7 +89,7 @@
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
if (!label_hnd) {
- log_enforcing("Failed to initialize SELinux context: %m");
+ log_enforcing("Failed to initialize SELinux context: %s", error_str());
r = security_getenforce() == 1 ? -errno : 0;
} else {
char timespan[FORMAT_TIMESPAN_MAX];
@@ -159,7 +159,7 @@
if (ignore_erofs && errno == EROFS)
return 0;
- log_enforcing("Unable to fix SELinux security context of %s: %m", path);
+ log_enforcing("Unable to fix SELinux security context of %s: %s", path, error_str());
if (security_getenforce() == 1)
return -errno;
}
@@ -178,7 +178,7 @@
return 0;
if (setfilecon(path, (security_context_t) label) < 0) {
- log_enforcing("Failed to set SELinux security context %s on path %s: %m", label, path);
+ log_enforcing("Failed to set SELinux security context %s on path %s: %s", label, path, error_str());
if (security_getenforce() == 1)
return -errno;
}
@@ -337,7 +337,7 @@
else {
r = setfscreatecon(filecon);
if (r < 0) {
- log_enforcing("Failed to set SELinux security context %s for %s: %m", filecon, path);
+ log_enforcing("Failed to set SELinux security context %s for %s: %s", filecon, path, error_str());
r = -errno;
}
}
@@ -370,7 +370,7 @@
assert(label);
if (setsockcreatecon((security_context_t) label) < 0) {
- log_enforcing("Failed to set SELinux security context %s for sockets: %m", label);
+ log_enforcing("Failed to set SELinux security context %s for sockets: %s", label, error_str());
if (security_getenforce() == 1)
return -errno;
@@ -440,7 +440,7 @@
r = setfscreatecon(fcon);
if (r < 0 && errno != ENOENT) {
- log_enforcing("Failed to set SELinux security context %s for %s: %m", fcon, path);
+ log_enforcing("Failed to set SELinux security context %s for %s: %s", fcon, path, error_str());
if (security_getenforce() == 1) {
r = -errno;
--- src/shared/sleep-config.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/sleep-config.c 2017-03-04 16:53:10.574346156 +0100
@@ -175,7 +175,7 @@
f = fopen("/proc/swaps", "re");
if (!f) {
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
- "Failed to retrieve open /proc/swaps: %m");
+ "Failed to retrieve open /proc/swaps: %s", error_str());
assert(errno > 0);
return -errno;
}
@@ -228,14 +228,14 @@
r = get_status_field("/proc/meminfo", "\nActive(anon):", &active);
if (r < 0) {
- log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %m");
+ log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %s", error_str());
return false;
}
r = safe_atollu(active, &act);
if (r < 0) {
- log_error_errno(r, "Failed to parse Active(anon) from /proc/meminfo: %s: %m",
- active);
+ log_error_errno(r, "Failed to parse Active(anon) from /proc/meminfo: %s: %s",
+ active, error_str());
return false;
}
--- src/shared/smack-util.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/smack-util.c 2017-03-04 16:53:10.568346146 +0100
@@ -199,7 +199,7 @@
if (ignore_erofs && errno == EROFS)
return 0;
- r = log_debug_errno(errno, "Unable to fix SMACK label of %s: %m", path);
+ r = log_debug_errno(errno, "Unable to fix SMACK label of %s: %s", path, error_str());
}
#endif
--- src/shared/socket-label.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/socket-label.c 2017-03-04 16:53:10.563346139 +0100
@@ -86,13 +86,13 @@
if (free_bind) {
one = 1;
if (setsockopt(fd, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0)
- log_warning_errno(errno, "IP_FREEBIND failed: %m");
+ log_warning_errno(errno, "IP_FREEBIND failed: %s", error_str());
}
if (transparent) {
one = 1;
if (setsockopt(fd, IPPROTO_IP, IP_TRANSPARENT, &one, sizeof(one)) < 0)
- log_warning_errno(errno, "IP_TRANSPARENT failed: %m");
+ log_warning_errno(errno, "IP_TRANSPARENT failed: %s", error_str());
}
}
@@ -155,10 +155,10 @@
r = socket_address_print(&a, &p);
if (r < 0)
- return log_error_errno(r, "socket_address_print(): %m");
+ return log_error_errno(r, "socket_address_print(): %s", error_str());
if (fd < 0)
- log_error_errno(fd, "Failed to listen on %s: %m", p);
+ log_error_errno(fd, "Failed to listen on %s: %s", p, error_str());
else
log_full(log_level, "Listening on %s", p);
}
--- src/shared/socket-util.c 2017-03-04 16:54:39.919484988 +0100
+++ src/shared/socket-util.c 2017-03-04 16:53:10.580346165 +0100
@@ -653,9 +653,9 @@
r = sockaddr_pretty(&sa->sa, salen, true, true, &ret);
if (r < 0)
- return log_error_errno(r, "sockadd_pretty() failed: %m");
+ return log_error_errno(r, "sockadd_pretty() failed: %s", error_str());
- log_debug_errno(saved_errno, "getnameinfo(%s) failed: %m", ret);
+ log_debug_errno(saved_errno, "getnameinfo(%s) failed: %s", ret, error_str());
} else {
ret = strdup(host);
if (!ret)
@@ -674,7 +674,7 @@
assert(ret);
if (getsockname(fd, &sa.sa, &salen) < 0)
- return log_error_errno(errno, "getsockname(%d) failed: %m", fd);
+ return log_error_errno(errno, "getsockname(%d) failed: %s", fd, error_str());
return socknameinfo_pretty(&sa, salen, ret);
}
--- src/shared/spawn-polkit-agent.c 2015-09-01 11:25:35.671430453 +0200
+++ src/shared/spawn-polkit-agent.c 2017-03-04 16:53:10.585346173 +0100
@@ -59,7 +59,7 @@
safe_close(pipe_fd[1]);
if (r < 0)
- log_error_errno(r, "Failed to fork TTY ask password agent: %m");
+ log_error_errno(r, "Failed to fork TTY ask password agent: %s", error_str());
else
/* Wait until the agent closes the fd */
fd_wait_for_event(pipe_fd[0], POLLHUP, USEC_INFINITY);
--- src/shared/util.c 2017-03-04 16:54:39.921484991 +0100
+++ src/shared/util.c 2017-03-04 16:53:10.607346206 +0100
@@ -2218,7 +2218,7 @@
r = reset_terminal_fd(fd, true);
if (r < 0)
- log_warning_errno(r, "Failed to reset terminal: %m");
+ log_warning_errno(r, "Failed to reset terminal: %s", error_str());
return fd;
@@ -3839,7 +3839,7 @@
r = wait_for_terminate(pid, &status);
if (r < 0)
- return log_warning_errno(r, "Failed to wait for %s: %m", name);
+ return log_warning_errno(r, "Failed to wait for %s: %s", name, error_str());
if (status.si_code == CLD_EXITED) {
if (status.si_status != 0)
@@ -4126,7 +4126,7 @@
if (errno == ENOENT)
continue;
- return log_error_errno(errno, "Failed to open directory %s: %m", *directory);
+ return log_error_errno(errno, "Failed to open directory %s: %s", *directory, error_str());
}
FOREACH_DIRENT(de, d, break) {
@@ -4157,7 +4157,7 @@
pid = fork();
if (pid < 0) {
- log_error_errno(errno, "Failed to fork: %m");
+ log_error_errno(errno, "Failed to fork: %s", error_str());
continue;
} else if (pid == 0) {
char *_argv[2];
@@ -4172,7 +4172,7 @@
argv[0] = path;
execv(path, argv);
- return log_error_errno(errno, "Failed to execute %s: %m", path);
+ return log_error_errno(errno, "Failed to execute %s: %s", path, error_str());
}
log_debug("Spawned %s as " PID_FMT ".", path, pid);
@@ -4225,7 +4225,7 @@
executor_pid = fork();
if (executor_pid < 0) {
- log_error_errno(errno, "Failed to fork: %m");
+ log_error_errno(errno, "Failed to fork: %s", error_str());
return;
} else if (executor_pid == 0) {
@@ -5398,7 +5398,7 @@
* keep an unused copy of stdin around. */
fd = open("/dev/tty", O_WRONLY);
if (fd < 0) {
- log_error_errno(errno, "Failed to open /dev/tty: %m");
+ log_error_errno(errno, "Failed to open /dev/tty: %s", error_str());
_exit(EXIT_FAILURE);
}
@@ -5613,11 +5613,11 @@
fd = acquire_terminal("/dev/console", false, true, true, USEC_INFINITY);
if (fd < 0)
- return log_error_errno(fd, "Failed to acquire terminal: %m");
+ return log_error_errno(fd, "Failed to acquire terminal: %s", error_str());
r = make_stdio(fd);
if (r < 0)
- return log_error_errno(r, "Failed to duplicate terminal fd: %m");
+ return log_error_errno(r, "Failed to duplicate terminal fd: %s", error_str());
return 0;
}
--- src/shared/watchdog.c 2015-04-19 13:32:24.667347471 +0200
+++ src/shared/watchdog.c 2017-03-04 16:53:10.590346180 +0100
@@ -45,7 +45,7 @@
flags = WDIOS_DISABLECARD;
r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
if (r < 0)
- return log_warning_errno(errno, "Failed to disable hardware watchdog: %m");
+ return log_warning_errno(errno, "Failed to disable hardware watchdog: %s", error_str());
} else {
int sec, flags;
char buf[FORMAT_TIMESPAN_MAX];
@@ -53,7 +53,7 @@
sec = (int) ((watchdog_timeout + USEC_PER_SEC - 1) / USEC_PER_SEC);
r = ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &sec);
if (r < 0)
- return log_warning_errno(errno, "Failed to set timeout to %is: %m", sec);
+ return log_warning_errno(errno, "Failed to set timeout to %is: %s", sec, error_str());
watchdog_timeout = (usec_t) sec * USEC_PER_SEC;
log_info("Set hardware watchdog to %s.", format_timespan(buf, sizeof(buf), watchdog_timeout, 0));
@@ -61,11 +61,11 @@
flags = WDIOS_ENABLECARD;
r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
if (r < 0)
- return log_warning_errno(errno, "Failed to enable hardware watchdog: %m");
+ return log_warning_errno(errno, "Failed to enable hardware watchdog: %s", error_str());
r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);
if (r < 0)
- return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
+ return log_warning_errno(errno, "Failed to ping hardware watchdog: %s", error_str());
}
return 0;
@@ -120,7 +120,7 @@
r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);
if (r < 0)
- return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
+ return log_warning_errno(errno, "Failed to ping hardware watchdog: %s", error_str());
return 0;
}
@@ -138,7 +138,7 @@
flags = WDIOS_DISABLECARD;
r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
if (r < 0)
- log_warning_errno(errno, "Failed to disable hardware watchdog: %m");
+ log_warning_errno(errno, "Failed to disable hardware watchdog: %s", error_str());
/* To be sure, use magic close logic, too */
for (;;) {
@@ -148,7 +148,7 @@
break;
if (errno != EINTR) {
- log_error_errno(errno, "Failed to disarm watchdog timer: %m");
+ log_error_errno(errno, "Failed to disarm watchdog timer: %s", error_str());
break;
}
}