public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] passt-repair: Dodge "structurally unreachable code" warning from Coverity
@ 2025-02-07  1:01 Stefano Brivio
  2025-02-07  1:18 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2025-02-07  1:01 UTC (permalink / raw)
  To: passt-dev; +Cc: Paul Holzinger

While main() conventionally returns int, and we need a return at the
end of the function to avoid compiler warnings, turning that return
into _exit() to avoid exit handlers triggers a Coverity warning. It's
unreachable code anyway, so switch that single occurence back to a
plain return.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 passt-repair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/passt-repair.c b/passt-repair.c
index 5ad5c9c..322066a 100644
--- a/passt-repair.c
+++ b/passt-repair.c
@@ -173,5 +173,5 @@ loop:
 
 	goto loop;
 
-	_exit(0);
+	return 0;
 }
-- 
@@ -173,5 +173,5 @@ loop:
 
 	goto loop;
 
-	_exit(0);
+	return 0;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] passt-repair: Dodge "structurally unreachable code" warning from Coverity
  2025-02-07  1:01 [PATCH] passt-repair: Dodge "structurally unreachable code" warning from Coverity Stefano Brivio
@ 2025-02-07  1:18 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2025-02-07  1:18 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev, Paul Holzinger

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

On Fri, Feb 07, 2025 at 02:01:17AM +0100, Stefano Brivio wrote:
> While main() conventionally returns int, and we need a return at the
> end of the function to avoid compiler warnings, turning that return
> into _exit() to avoid exit handlers triggers a Coverity warning. It's
> unreachable code anyway, so switch that single occurence back to a
> plain return.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Gross that we need these workaround hacks, but

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  passt-repair.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/passt-repair.c b/passt-repair.c
> index 5ad5c9c..322066a 100644
> --- a/passt-repair.c
> +++ b/passt-repair.c
> @@ -173,5 +173,5 @@ loop:
>  
>  	goto loop;
>  
> -	_exit(0);
> +	return 0;
>  }

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-07  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-07  1:01 [PATCH] passt-repair: Dodge "structurally unreachable code" warning from Coverity Stefano Brivio
2025-02-07  1:18 ` David Gibson

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).