aed857
From 8f47d483dc4e0510977c8868278148c476f58c17 Mon Sep 17 00:00:00 2001
aed857
From: Michal Sekletar <msekleta@redhat.com>
aed857
Date: Tue, 4 Sep 2018 19:51:14 +0200
aed857
Subject: [PATCH] cryptsetup-generator: don't return error if target directory
aed857
 already exists
aed857
aed857
Related: #1619743
aed857
---
aed857
 src/cryptsetup/cryptsetup-generator.c | 6 +++---
aed857
 1 file changed, 3 insertions(+), 3 deletions(-)
aed857
aed857
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
Pablo Greco 48fc63
index 42c30c5ca9..a9598180c6 100644
aed857
--- a/src/cryptsetup/cryptsetup-generator.c
aed857
+++ b/src/cryptsetup/cryptsetup-generator.c
aed857
@@ -63,11 +63,11 @@ static int generate_keydev_mount(const char *name, const char *keydev, char **un
aed857
         assert(mount);
aed857
 
aed857
         r = mkdir_parents("/run/systemd/cryptsetup", 0755);
aed857
-        if (r < 0)
aed857
+        if (r < 0 && r != -EEXIST)
aed857
                 return r;
aed857
 
aed857
         r = mkdir("/run/systemd/cryptsetup", 0700);
aed857
-        if (r < 0)
aed857
+        if (r < 0 && errno != EEXIST)
aed857
                 return r;
aed857
 
aed857
         where = strjoin("/run/systemd/cryptsetup/keydev-", name, NULL);
aed857
@@ -75,7 +75,7 @@ static int generate_keydev_mount(const char *name, const char *keydev, char **un
aed857
                 return -ENOMEM;
aed857
 
aed857
         r = mkdir(where, 0700);
aed857
-        if (r < 0)
aed857
+        if (r < 0 && errno != EEXIST)
aed857
                 return r;
aed857
 
aed857
         u = unit_name_from_path(where, ".mount");