]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup-generator: don't return error if target directory already exists
authorMichal Sekletar <msekleta@redhat.com>
Tue, 4 Sep 2018 17:51:14 +0000 (19:51 +0200)
committerMichal Sekletar <msekleta@redhat.com>
Tue, 30 Oct 2018 08:02:34 +0000 (09:02 +0100)
src/cryptsetup/cryptsetup-generator.c

index c3a4509030f509c5e56d60acb50ed493e79a8d97..892e41ce18aa137ca96bd639cd4170e911611b65 100644 (file)
@@ -54,16 +54,16 @@ static int generate_keydev_mount(const char *name, const char *keydev, char **un
                 return r;
 
         r = mkdir("/run/systemd/cryptsetup", 0700);
-        if (r < 0)
-                return r;
+        if (r < 0 && errno != EEXIST)
+                return -errno;
 
         where = strjoin("/run/systemd/cryptsetup/keydev-", name);
         if (!where)
                 return -ENOMEM;
 
         r = mkdir(where, 0700);
-        if (r < 0)
-                return r;
+        if (r < 0 && errno != EEXIST)
+                return -errno;
 
         r = unit_name_from_path(where, ".mount", &u);
         if (r < 0)