diff mbox series

[v4,05/15] sunrpc/netname.c: fix warn unused result

Message ID 20230428122142.928135-6-fberat@redhat.com
State New
Headers show
Series Fix warn unused result | expand

Commit Message

Frederic Berat April 28, 2023, 12:21 p.m. UTC
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.
---
 sunrpc/netname.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Siddhesh Poyarekar May 25, 2023, 12:53 a.m. UTC | #1
On 2023-04-28 08:21, Frédéric Bérat wrote:
> Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
> glibc.
> ---
>   sunrpc/netname.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

> 
> diff --git a/sunrpc/netname.c b/sunrpc/netname.c
> index dd2cb1b441..d9d82501b0 100644
> --- a/sunrpc/netname.c
> +++ b/sunrpc/netname.c
> @@ -96,7 +96,8 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
>         else
>   	{
>   	  domainname[0] = 0;
> -	  getdomainname (domainname, MAXHOSTNAMELEN);
> +	  if (getdomainname (domainname, MAXHOSTNAMELEN))
> +	    return 0;
>   	}
>       }
>     else
diff mbox series

Patch

diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index dd2cb1b441..d9d82501b0 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -96,7 +96,8 @@  host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
       else
 	{
 	  domainname[0] = 0;
-	  getdomainname (domainname, MAXHOSTNAMELEN);
+	  if (getdomainname (domainname, MAXHOSTNAMELEN))
+	    return 0;
 	}
     }
   else