]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Properly return error from virGetUserID and virGetGroupID stubs
authorPeter Krempa <pkrempa@redhat.com>
Mon, 8 Jun 2015 07:32:24 +0000 (09:32 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 8 Jun 2015 07:32:24 +0000 (09:32 +0200)
The stubs for the two functions that are compiled on platforms that
don't have HAVE_GETPWUID_R and friends defined do not return error but
report an error message. The calling code then assumes that the @uid or
@gid arguments were filled, which is not the case in the stubs.

src/util/virutil.c

index e479cce9be9dca54749fb1afd1f5ed111949468a..cddc78a700c12a4f786a1f6544b92b8ee19c85f5 100644 (file)
@@ -1316,7 +1316,7 @@ int virGetUserID(const char *name ATTRIBUTE_UNUSED,
     virReportError(VIR_ERR_INTERNAL_ERROR,
                    "%s", _("virGetUserID is not available"));
 
-    return 0;
+    return -1;
 }
 
 
@@ -1326,7 +1326,7 @@ int virGetGroupID(const char *name ATTRIBUTE_UNUSED,
     virReportError(VIR_ERR_INTERNAL_ERROR,
                    "%s", _("virGetGroupID is not available"));
 
-    return 0;
+    return -1;
 }
 
 int