Blame SOURCES/0050-cryptsetup-generator-don-t-return-error-if-target-di.patch

a3e2b5
From 81df5f597257bd2579246de6182c4949b27396eb Mon Sep 17 00:00:00 2001
a3e2b5
From: Michal Sekletar <msekleta@redhat.com>
a3e2b5
Date: Tue, 4 Sep 2018 19:51:14 +0200
a3e2b5
Subject: [PATCH] cryptsetup-generator: don't return error if target directory
a3e2b5
 already exists
a3e2b5
a3e2b5
(cherry-picked from commit 579875bc4a59b917fa32519e3d96d56dc591ad1e)
a3e2b5
a3e2b5
Related: #1656869
a3e2b5
---
a3e2b5
 src/cryptsetup/cryptsetup-generator.c | 8 ++++----
a3e2b5
 1 file changed, 4 insertions(+), 4 deletions(-)
a3e2b5
a3e2b5
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
a3e2b5
index 52391bd185..03c513c26e 100644
a3e2b5
--- a/src/cryptsetup/cryptsetup-generator.c
a3e2b5
+++ b/src/cryptsetup/cryptsetup-generator.c
a3e2b5
@@ -53,16 +53,16 @@ static int generate_keydev_mount(const char *name, const char *keydev, char **un
a3e2b5
                 return r;
a3e2b5
 
a3e2b5
         r = mkdir("/run/systemd/cryptsetup", 0700);
a3e2b5
-        if (r < 0)
a3e2b5
-                return r;
a3e2b5
+        if (r < 0 && errno != EEXIST)
a3e2b5
+                return -errno;
a3e2b5
 
a3e2b5
         where = strjoin("/run/systemd/cryptsetup/keydev-", name);
a3e2b5
         if (!where)
a3e2b5
                 return -ENOMEM;
a3e2b5
 
a3e2b5
         r = mkdir(where, 0700);
a3e2b5
-        if (r < 0)
a3e2b5
-                return r;
a3e2b5
+        if (r < 0 && errno != EEXIST)
a3e2b5
+                return -errno;
a3e2b5
 
a3e2b5
         r = unit_name_from_path(where, ".mount", &u);
a3e2b5
         if (r < 0)