From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: patches@linaro.org
Subject: [Qemu-trivial] [PATCH for-2.10 3/4] bsd-user/bsdload.c: Remove write-only id_change variable
Date: Tue, 18 Jul 2017 17:26:33 +0100 [thread overview]
Message-ID: <1500395194-21455-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1500395194-21455-1-git-send-email-peter.maydell@linaro.org>
On OpenBSD the compiler complains:
bsd-user/bsdload.c:54:17: warning: variable 'id_change' set but not used [-Wunused-but-set-variable]
This is dead code that was originally copied from linux-user.
We fixed this in linux-user in commit 331c23b5ca44293d1 in 2011;
delete the useless code from bsd-user too.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
bsd-user/bsdload.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c
index 94eec36..f38c4fa 100644
--- a/bsd-user/bsdload.c
+++ b/bsd-user/bsdload.c
@@ -20,22 +20,6 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
return 0;
}
-static int in_group_p(gid_t g)
-{
- /* return TRUE if we're in the specified group, FALSE otherwise */
- int ngroup;
- int i;
- gid_t grouplist[TARGET_NGROUPS];
-
- ngroup = getgroups(TARGET_NGROUPS, grouplist);
- for(i = 0; i < ngroup; i++) {
- if(grouplist[i] == g) {
- return 1;
- }
- }
- return 0;
-}
-
static int count(char ** vec)
{
int i;
@@ -51,7 +35,7 @@ static int prepare_binprm(struct linux_binprm *bprm)
{
struct stat st;
int mode;
- int retval, id_change;
+ int retval;
if(fstat(bprm->fd, &st) < 0) {
return(-errno);
@@ -67,14 +51,10 @@ static int prepare_binprm(struct linux_binprm *bprm)
bprm->e_uid = geteuid();
bprm->e_gid = getegid();
- id_change = 0;
/* Set-uid? */
if(mode & S_ISUID) {
bprm->e_uid = st.st_uid;
- if(bprm->e_uid != geteuid()) {
- id_change = 1;
- }
}
/* Set-gid? */
@@ -85,9 +65,6 @@ static int prepare_binprm(struct linux_binprm *bprm)
*/
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
bprm->e_gid = st.st_gid;
- if (!in_group_p(bprm->e_gid)) {
- id_change = 1;
- }
}
memset(bprm->buf, 0, sizeof(bprm->buf));
--
2.7.4
next prev parent reply other threads:[~2017-07-18 16:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 16:26 [Qemu-trivial] [PATCH for-2.10 0/4] bsd-user: silence warnings on OpenBSD Peter Maydell
2017-07-18 16:26 ` [Qemu-trivial] [PATCH for-2.10 1/4] bsd-user/mmap.c: Move __thread attribute to right place Peter Maydell
2017-07-18 16:45 ` [Qemu-trivial] [Qemu-devel] " Philippe Mathieu-Daudé
2017-07-18 16:26 ` [Qemu-trivial] [PATCH for-2.10 2/4] bsd-user/elfload.c: Fix set-but-not-used warnings Peter Maydell
2017-07-18 16:44 ` Philippe Mathieu-Daudé
2017-07-18 16:26 ` Peter Maydell [this message]
2017-07-21 11:12 ` [Qemu-trivial] [Qemu-devel] [PATCH for-2.10 3/4] bsd-user/bsdload.c: Remove write-only id_change variable Thomas Huth
2017-07-21 15:25 ` Peter Maydell
2017-07-18 16:26 ` [Qemu-trivial] [PATCH for-2.10 4/4] bsd-user/main.c: Fix unused variable warning Peter Maydell
2017-07-18 22:01 ` [Qemu-trivial] [Qemu-devel] " Eric Blake
2017-07-19 8:19 ` Peter Maydell
2017-07-21 11:18 ` Thomas Huth
2017-07-21 12:23 ` Eric Blake
2017-07-21 15:25 ` Peter Maydell
2017-07-18 21:29 ` [Qemu-trivial] [Qemu-devel] [PATCH for-2.10 0/4] bsd-user: silence warnings on OpenBSD no-reply
2017-07-21 10:27 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500395194-21455-4-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).