[PATCH 1/3] Add missing error reporting

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

 



On two places, there were errors not being reported.  One strdup
without virReportOOMError() and call for virFileMakePathHelper() which
doesn't report any errors, just sets errno (or leaves it set by
underlying functions).

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/util/virutil.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index 6890362..5fd0ce0 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1322,10 +1322,14 @@ virFileMakePathWithMode(const char *path,
     int ret = -1;
     char *tmp;

-    if ((tmp = strdup(path)) == NULL)
+    if ((tmp = strdup(path)) == NULL) {
+        virReportOOMError();
         goto cleanup;
+    }

     ret = virFileMakePathHelper(tmp, mode);
+    if (ret < 0)
+        virReportSystemError(errno, _("Cannot create directory '%s'"), path);

 cleanup:
     VIR_FREE(tmp);
-- 
1.8.1.5

--
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]