[PATCH] virt-aa-helper: fix bool initialization

christian.ehrhardt@canonical.com posted 1 patch 2 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211116081843.1064412-1-christian.ehrhardt@canonical.com
src/security/virt-aa-helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] virt-aa-helper: fix bool initialization
Posted by christian.ehrhardt@canonical.com 2 years, 5 months ago
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>

Since purged is a bool variable it should be initialized by false
instead of 0.

Suggested-by: Sergio Durigan Junior <sergio.durigan@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 src/security/virt-aa-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 218e07bfb0..898f9f1a16 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1438,7 +1438,7 @@ main(int argc, char **argv)
     char *profile = NULL;
     char *include_file = NULL;
     off_t size;
-    bool purged = 0;
+    bool purged = false;
 
     if (virGettextInitialize() < 0 ||
         virErrorInitialize() < 0) {
-- 
2.33.1


Re: [PATCH] virt-aa-helper: fix bool initialization
Posted by Jiri Denemark 2 years, 5 months ago
On Tue, Nov 16, 2021 at 09:18:43 +0100, christian.ehrhardt@canonical.com wrote:
> From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> 
> Since purged is a bool variable it should be initialized by false
> instead of 0.
> 
> Suggested-by: Sergio Durigan Junior <sergio.durigan@canonical.com>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  src/security/virt-aa-helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
> index 218e07bfb0..898f9f1a16 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -1438,7 +1438,7 @@ main(int argc, char **argv)
>      char *profile = NULL;
>      char *include_file = NULL;
>      off_t size;
> -    bool purged = 0;
> +    bool purged = false;
>  
>      if (virGettextInitialize() < 0 ||
>          virErrorInitialize() < 0) {

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>