[libvirt] [PATCH v3 2/2] util: Fix virDoes*Exist return typ

Martin Kletzander mkletzan at redhat.com
Mon Nov 19 21:35:57 UTC 2018


Since the functions only return 0 or 1, they should return bool.  I missed the
change when "refactoring" the first commit.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/util/virutil.c | 12 ++++++------
 src/util/virutil.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index c0783ecb285b..974cffc2eeb7 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1133,7 +1133,7 @@ virGetGroupID(const char *group, gid_t *gid)
 /* Silently checks if User @name exists.
  * Returns if the user exists and fallbacks to false on error.
  */
-int
+bool
 virDoesUserExist(const char *name)
 {
     return virGetUserIDByName(name, NULL, true) == 0;
@@ -1142,7 +1142,7 @@ virDoesUserExist(const char *name)
 /* Silently checks if Group @name exists.
  * Returns if the group exists and fallbacks to false on error.
  */
-int
+bool
 virDoesGroupExist(const char *name)
 {
     return virGetGroupIDByName(name, NULL, true) == 0;
@@ -1243,16 +1243,16 @@ virGetGroupList(uid_t uid ATTRIBUTE_UNUSED, gid_t gid ATTRIBUTE_UNUSED,
     return 0;
 }
 
-int
+bool
 virDoesUserExist(const char *name ATTRIBUTE_UNUSED)
 {
-    return 0;
+    return false;
 }
 
-int
+bool
 virDoesGroupExist(const char *name ATTRIBUTE_UNUSED)
 {
-    return 0;
+    return false;
 }
 
 # ifdef WIN32
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 2407f54efd47..e0ab0da0f2fc 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -152,8 +152,8 @@ int virGetUserID(const char *name,
 int virGetGroupID(const char *name,
                   gid_t *gid) ATTRIBUTE_RETURN_CHECK;
 
-int virDoesUserExist(const char *name);
-int virDoesGroupExist(const char *name);
+bool virDoesUserExist(const char *name);
+bool virDoesGroupExist(const char *name);
 
 
 bool virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
-- 
2.19.1




More information about the libvir-list mailing list