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

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



From: "Daniel P. Berrange" <berrange redhat com>

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 redhat com>
---
 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


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