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

Merge pull request #2939 from bjne/read_only_bindmount

dont create bind-mount target when it exists
This commit is contained in:
Lennart Poettering 2016-04-01 18:25:34 +02:00
commit 2685875eb1

View File

@ -438,9 +438,6 @@ static int mount_bind(const char *dest, CustomMount *m) {
r = mkdir_parents_label(where, 0755); r = mkdir_parents_label(where, 0755);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to make parents of %s: %m", where); return log_error_errno(r, "Failed to make parents of %s: %m", where);
} else {
return log_error_errno(errno, "Failed to stat %s: %m", where);
}
/* Create the mount point. Any non-directory file can be /* Create the mount point. Any non-directory file can be
* mounted on any non-directory file (regular, fifo, socket, * mounted on any non-directory file (regular, fifo, socket,
@ -450,9 +447,13 @@ static int mount_bind(const char *dest, CustomMount *m) {
r = mkdir_label(where, 0755); r = mkdir_label(where, 0755);
else else
r = touch(where); r = touch(where);
if (r < 0 && r != -EEXIST) if (r < 0)
return log_error_errno(r, "Failed to create mount point %s: %m", where); return log_error_errno(r, "Failed to create mount point %s: %m", where);
} else {
return log_error_errno(errno, "Failed to stat %s: %m", where);
}
if (mount(m->source, where, NULL, mount_flags, mount_opts) < 0) if (mount(m->source, where, NULL, mount_flags, mount_opts) < 0)
return log_error_errno(errno, "mount(%s) failed: %m", where); return log_error_errno(errno, "mount(%s) failed: %m", where);