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