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

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



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


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