chiark / gitweb /
tree-wide: spelling fixes
[elogind.git] / src / core / automount.c
index bc2834334e2fa9930902ee252e157c4e15f2e1f6..90beb4daaaba4ecae5541731432bae9f47405653 100644 (file)
@@ -75,7 +75,7 @@ static void repeat_unmount(const char *path) {
                         continue;
 
                 if (errno != EINVAL)
-                        log_error("Failed to unmount: %m");
+                        log_error_errno(errno, "Failed to unmount: %m");
 
                 break;
         }
@@ -300,10 +300,8 @@ static int open_dev_autofs(Manager *m) {
         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(&param);
         if (ioctl(m->dev_autofs_fd, AUTOFS_DEV_IOCTL_VERSION, &param) < 0) {
@@ -809,6 +807,17 @@ static void automount_reset_failed(Unit *u) {
         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",
@@ -861,6 +870,7 @@ const UnitVTable automount_vtable = {
         .bus_vtable = bus_automount_vtable,
 
         .shutdown = automount_shutdown,
+        .supported = automount_supported,
 
         .status_message_formats = {
                 .finished_start_job = {