Message ID | 20230418121130.844302-4-fberat@redhat.com |
---|---|
State | New |
Headers | show |
Series | Fix warn unused result | expand |
On 2023-04-18 08:11, Frédéric Bérat via Libc-alpha wrote: > Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in > glibc. > --- > inet/rcmd.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) LGTM. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> > > 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;
On Apr 18 2023, Frédéric Bérat via Libc-alpha wrote: > 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; Wrong indentation. > @@ -570,7 +572,8 @@ ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser, > fclose (hostf); > } > > - seteuid (uid); > + if (seteuid (uid) < 0) > + return -1; Wrong indentation.
On 2023-04-18 09:40, Andreas Schwab wrote: > On Apr 18 2023, Frédéric Bérat via Libc-alpha wrote: > >> 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; > > Wrong indentation. > >> @@ -570,7 +572,8 @@ ruserok2_sa (struct sockaddr *ra, size_t ralen, int superuser, >> fclose (hostf); >> } >> >> - seteuid (uid); >> + if (seteuid (uid) < 0) >> + return -1; > > Wrong indentation. > Oops, I pushed an obvious change fixing that. Thanks, Sid
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;