[PATCH sandbox 1/9] Check return value from mkdir in libvirt-sandbox-init-qemu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Most calls to mkdir() in libvirt-sandbox-init-qemu had their
return value checked, but one was missed.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 libvirt-sandbox/libvirt-sandbox-init-qemu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
index f09c6d9..012c6a2 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
@@ -541,7 +541,11 @@ print_uptime(void)
 
 static void set_debug(void)
 {
-    mkdir("/proc", 0755);
+    if (mkdir("/proc", 0755) < 0) {
+        fprintf(stderr, "libvirt-sandbox-init-qemu: %s: cannot mkdir /proc: %s\n",
+                __func__, strerror(errno));
+        exit_poweroff();
+    }
     if (mount("none", "/proc", "proc", 0, "") < 0) {
         fprintf(stderr, "libvirt-sandbox-init-qemu: %s: cannot mount /proc: %s\n",
                 __func__, strerror(errno));
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]