about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-04-18 09:01:00 -0400
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-04-18 09:01:00 -0400
commit1629adf2a6eefe5ddddc2445e2d056ca80edfe8b (patch)
tree885629e16067e1f51e2691918c284a4c9528506a
parentcb9cae962c315139941a6eb0d07c6a71b658f5bb (diff)
downloadglibc-1629adf2a6eefe5ddddc2445e2d056ca80edfe8b.tar.gz
glibc-1629adf2a6eefe5ddddc2445e2d056ca80edfe8b.tar.xz
glibc-1629adf2a6eefe5ddddc2445e2d056ca80edfe8b.zip
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>
-rw-r--r--inet/rcmd.c7
1 files 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;