From 1629adf2a6eefe5ddddc2445e2d056ca80edfe8b Mon Sep 17 00:00:00 2001
From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
Date: Tue, 18 Apr 2023 09:01:00 -0400
Subject: [PATCH] inet/rcmd.c: fix warn unused result

Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
 inet/rcmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/inet/rcmd.c b/inet/rcmd.c
index ad8a894907..c1cd9daeb5 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -561,7 +561,9 @@ ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser,
 	  reading an NFS mounted file system, can't read files that
 	  are protected read/write owner only.  */
        uid = __geteuid ();
-       seteuid (pwd->pw_uid);
+       if (seteuid (pwd->pw_uid) < 0)
+	       return -1;
+
        hostf = iruserfopen (pbuf, pwd->pw_uid);
 
        if (hostf != NULL)
@@ -570,7 +572,8 @@ ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser,
 	   fclose (hostf);
 	 }
 
-       seteuid (uid);
+       if (seteuid (uid) < 0)
+	       return -1;
        return isbad;
     }
   return -1;
-- 
2.39.3

