1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

cryptsetup-generator: don't return error if target directory already exists

This commit is contained in:
Michal Sekletar 2018-09-04 19:51:14 +02:00
parent b9e7ea4841
commit 579875bc4a

View File

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