diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-02 19:40:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-02 19:45:12 +0200 |
commit | 51045322c4c19638ba5588c722238220d096ca43 (patch) | |
tree | ba85bc3913e55440a98f964a88d28950e76a61bd /src/nspawn | |
parent | 69c2b6be8fc607412a13cd0ea03a629b4965c816 (diff) |
nspawn: always copy /etc/resolv.conf rather than bind mount
We were already creating the file if it was missing, and this way
containers can reconfigure the file without running into problems.
This also makes resolv.conf handling more alike to handling of
/etc/localtime, which is also not a bind mount.
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index eb9605c356..fc4a8a36c8 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -521,7 +521,6 @@ static int setup_timezone(const char *dest) { static int setup_resolv_conf(const char *dest) { char _cleanup_free_ *where = NULL; - _cleanup_close_ int fd = -1; assert(dest); @@ -533,18 +532,9 @@ static int setup_resolv_conf(const char *dest) { if (!where) return log_oom(); - fd = open(where, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644); - /* We don't really care for the results of this really. If it * fails, it fails, but meh... */ - if (mount("/etc/resolv.conf", where, "bind", MS_BIND, NULL) < 0) - log_warning("Failed to bind mount /etc/resolv.conf: %m"); - else - if (mount("/etc/resolv.conf", where, "bind", - MS_BIND|MS_REMOUNT|MS_RDONLY, NULL) < 0) { - log_error("Failed to remount /etc/resolv.conf readonly: %m"); - return -errno; - } + copy_file("/etc/resolv.conf", where, O_TRUNC|O_NOFOLLOW); return 0; } |