summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2015-06-18 21:38:09 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2015-06-18 21:38:09 +0200
commitea0707c6613edd057ee33667416b43cc89a7d863 (patch)
treed8585b6749f90045dab54f73fff8d541ec191850
parentc874ef05a705d3c679e5fd5a50b81e1f5512c4fd (diff)
parent68a313c5921d32896136e0775ecb375b0be60206 (diff)
Merge pull request #291 from poettering/nspawn-suppress-eloop
nspawn: suppress warning when /etc/resolv.conf is a valid symlink
-rw-r--r--src/nspawn/nspawn.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index d1154de08a..4cf2d14ae2 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1538,7 +1538,16 @@ static int setup_resolv_conf(const char *dest) {
r = copy_file("/etc/resolv.conf", where, O_TRUNC|O_NOFOLLOW, 0644, 0);
if (r < 0) {
- log_warning_errno(r, "Failed to copy /etc/resolv.conf to %s: %m", where);
+ /* If the file already exists as symlink, let's
+ * suppress the warning, under the assumption that
+ * resolved or something similar runs inside and the
+ * symlink points there.
+ *
+ * If the disk image is read-only, there's also no
+ * point in complaining.
+ */
+ log_full_errno(IN_SET(r, -ELOOP, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ "Failed to copy /etc/resolv.conf to %s: %m", where);
return 0;
}