summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-09-29 13:20:54 +0200
committerTom Gundersen <teg@jklm.no>2014-09-29 20:52:10 +0200
commite8c8ddccfc63574069c30b7e75f0ccfd5b03eab9 (patch)
tree8f43418fea7162889cd3b8dd4c902ca060694d6a /src
parentb1d6dcf5a5c5aa02843c026dede0638f77798cb4 (diff)
nspawn: log when tearing down of loop device fails
Diffstat (limited to 'src')
-rw-r--r--src/nspawn/nspawn.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 4c1cfabca4..34436b82a2 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2607,20 +2607,27 @@ static int mount_devices(
static void loop_remove(int nr, int *image_fd) {
_cleanup_close_ int control = -1;
+ int r;
if (nr < 0)
return;
if (image_fd && *image_fd >= 0) {
- ioctl(*image_fd, LOOP_CLR_FD);
+ r = ioctl(*image_fd, LOOP_CLR_FD);
+ if (r < 0)
+ log_warning("Failed to close loop image: %m");
*image_fd = safe_close(*image_fd);
}
control = open("/dev/loop-control", O_RDWR|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
- if (control < 0)
+ if (control < 0) {
+ log_warning("Failed to open /dev/loop-control: %m");
return;
+ }
- ioctl(control, LOOP_CTL_REMOVE, nr);
+ r = ioctl(control, LOOP_CTL_REMOVE, nr);
+ if (r < 0)
+ log_warning("Failed to remove loop %d: %m", nr);
}
static int spawn_getent(const char *database, const char *key, pid_t *rpid) {