]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc_monitor: Check return value of write
authorStéphane Graber <stgraber@ubuntu.com>
Fri, 6 Dec 2013 22:19:23 +0000 (17:19 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 6 Dec 2013 22:31:51 +0000 (17:31 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_monitor.c

index 63ab68be48a9e52c0bccf05eeb934a8567ab63b0..4ac927a5dac578d74d6a876a4a7d6c729993083f 100644 (file)
@@ -93,11 +93,16 @@ int main(int argc, char *argv[])
 
                        fd = lxc_monitor_open(my_args.lxcpath[i]);
                        if (fd < 0) {
-                               ERROR("Unable to open monitor on path:%s", my_args.lxcpath[i]);
+                               ERROR("Unable to open monitor on path: %s", my_args.lxcpath[i]);
                                ret = EXIT_FAILURE;
                                continue;
                        }
-                       write(fd, "quit", 4);
+                       if (write(fd, "quit", 4) < 0) {
+                               SYSERROR("Unable to close monitor on path: %s", my_args.lxcpath[i]);
+                               ret = EXIT_FAILURE;
+                               close(fd);
+                               continue;
+                       }
                        close(fd);
                }
                return ret;