chiark / gitweb /
sd-daemon: set FD_CLOEXEC by default
[elogind.git] / src / automount.c
index 730b1572c2ddfff4102e6b9c0e7ee61d0b32de2c..d83f3ed053aecbf4c54397160db3b5c0a827f7e3 100644 (file)
@@ -276,18 +276,8 @@ static int open_dev_autofs(Manager *m) {
                 return m->dev_autofs_fd;
 
         if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
-
-                if (errno == ENOENT || errno == ENODEV) {
-                        log_error("Your kernel apparently lacks built-in autofs4 support. Please fix that. "
-                                  "We'll now try to work around this by calling 'modprobe autofs4'...");
-                        system("/sbin/modprobe -q -- autofs4");
-                        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));
-                        return -errno;
-                }
+                log_error("Failed to open /dev/autofs: %s", strerror(errno));
+                return -errno;
         }
 
         init_autofs_dev_ioctl(&param);
@@ -572,12 +562,15 @@ static int automount_start(Unit *u) {
 
         assert(a);
 
+        assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_MAINTAINANCE);
+
         if (path_is_mount_point(a->where)) {
                 log_error("Path %s is already a mount point, refusing start for %s", a->where, u->meta.id);
                 return -EEXIST;
         }
 
-        assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_MAINTAINANCE);
+        if (a->mount->meta.load_state != UNIT_LOADED)
+                return -ENOENT;
 
         a->failure = false;
         automount_enter_waiting(a);