[libvirt] [PATCH 1/3] Add missing error reporting

Martin Kletzander mkletzan at redhat.com
Thu Apr 18 10:30:54 UTC 2013


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




More information about the libvir-list mailing list