[libvirt PATCH] util: Improve macOS workaround

Andrea Bolognani posted 1 patch 2 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220328154957.378129-1-abologna@redhat.com
Test syntax-check passed
src/util/virutil.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[libvirt PATCH] util: Improve macOS workaround
Posted by Andrea Bolognani 2 years, 1 month ago
Since the workaround is specific to macOS, only disable compiler
warnings when building on that platform.

While at it, update the comment to reflect the fact that the
workaround is needed for all versions of the OS, including the
modern ones that we currently target.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/502990271

 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 fe5500726e..176e2f8f59 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -869,9 +869,11 @@ virDoesGroupExist(const char *name)
 
 
 
-/* Work around an incompatibility of OS X 10.11: getgrouplist
+/* Work around an incompatibility of macOS: getgrouplist
    accepts int *, not gid_t *, and int and gid_t differ in sign.  */
+# ifdef __APPLE__
 VIR_WARNINGS_NO_POINTER_SIGN
+# endif
 
 /* Compute the list of primary and supplementary groups associated
  * with @uid, and including @gid in the list (unless it is -1),
@@ -934,7 +936,9 @@ virGetGroupList(uid_t uid, gid_t gid, gid_t **list)
     return ret;
 }
 
+# ifdef __APPLE__
 VIR_WARNINGS_RESET
+# endif
 
 
 /* Set the real and effective uid and gid to the given values, as well
-- 
2.35.1
Re: [libvirt PATCH] util: Improve macOS workaround
Posted by Michal Prívozník 2 years, 1 month ago
On 3/28/22 17:49, Andrea Bolognani wrote:
> Since the workaround is specific to macOS, only disable compiler
> warnings when building on that platform.
> 
> While at it, update the comment to reflect the fact that the
> workaround is needed for all versions of the OS, including the
> modern ones that we currently target.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
> Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/502990271
> 
>  src/util/virutil.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal