continue;
if (errno != EINVAL)
- log_error("Failed to unmount: %m");
+ log_error_errno(errno, "Failed to unmount: %m");
break;
}
label_fix("/dev/autofs", false, false);
m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY);
- if (m->dev_autofs_fd < 0) {
- log_error("Failed to open /dev/autofs: %m");
- return -errno;
- }
+ if (m->dev_autofs_fd < 0)
+ return log_error_errno(errno, "Failed to open /dev/autofs: %m");
init_autofs_dev_ioctl(¶m);
if (ioctl(m->dev_autofs_fd, AUTOFS_DEV_IOCTL_VERSION, ¶m) < 0) {
return ioctl_fd;
if (status)
- log_unit_debug(UNIT(a)->id, "Sending failure: %s", strerror(-status));
+ log_unit_debug_errno(UNIT(a)->id, status, "Sending failure: %m");
else
log_unit_debug(UNIT(a)->id, "Sending success.");
l = loop_read(a->pipe_fd, &packet, sizeof(packet), true);
if (l != sizeof(packet)) {
- log_unit_error(UNIT(a)->id, "Invalid read from pipe: %s", l < 0 ? strerror(-l) : "short read");
+ if (l < 0)
+ log_unit_error_errno(UNIT(a)->id, l, "Invalid read from pipe: %m");
+ else
+ log_unit_error(UNIT(a)->id, "Invalid read from pipe: short read");
goto fail;
}
r = set_put(a->tokens, UINT_TO_PTR(packet.v5_packet.wait_queue_token));
if (r < 0) {
- log_unit_error(UNIT(a)->id, "Failed to remember token: %s", strerror(-r));
+ log_unit_error_errno(UNIT(a)->id, r, "Failed to remember token: %m");
goto fail;
}
a->result = AUTOMOUNT_SUCCESS;
}
+static bool automount_supported(Manager *m) {
+ static int supported = -1;
+
+ assert(m);
+
+ if (supported < 0)
+ supported = access("/dev/autofs", F_OK) >= 0;
+
+ return supported;
+}
+
static const char* const automount_state_table[_AUTOMOUNT_STATE_MAX] = {
[AUTOMOUNT_DEAD] = "dead",
[AUTOMOUNT_WAITING] = "waiting",
.bus_vtable = bus_automount_vtable,
.shutdown = automount_shutdown,
+ .supported = automount_supported,
.status_message_formats = {
.finished_start_job = {