inet: fix warn unused result

(cherry picked from commit 802108b8501a08d882d784fc9eba1c81388e56eb)
This commit is contained in:
chengyechun 2023-08-09 10:51:35 +08:00 committed by openeuler-sync-bot
parent 74c246474c
commit e6fbc6502f
2 changed files with 46 additions and 1 deletions

View File

@ -70,7 +70,7 @@
##############################################################################
Name: glibc
Version: 2.34
Release: 129
Release: 130
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -327,6 +327,7 @@ Patch9044: add-Wl-z-noseparate-code-for-so.patch
Patch9045: display-declaration-fstat-function-make-fstat-call-t.patch
Patch9046: fix-Segmentation-fault-in-nss-module.patch
Patch9047: fix_nss_database_check_reload_and_get_memleak.patch
Patch9048: inet-fix-warn-unused-result.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -1492,6 +1493,9 @@ fi
%endif
%changelog
* Wed Aug 9 2023 liubo<liubo335@huawei.com> - 2.34-130
- inet fix warn unused result
* Mon Aug 7 2023 zhanghao<zhanghao383@huawei.com> - 2.34-129
- fix Segmentation fault in nss module
- fix nss database check reload and get memleak

View File

@ -0,0 +1,41 @@
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