diff mbox

[05/14] linuxload: id_change was a write only variable

Message ID 40cc2aebc5a57aced2bd09c3b3da8dde58f8a707.1307014902.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela June 2, 2011, 11:53 a.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 linux-user/linuxload.c |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

Comments

Peter Maydell June 10, 2011, 5:04 p.m. UTC | #1
On 2 June 2011 12:53, Juan Quintela <quintela@redhat.com> wrote:
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

It does seem a bit odd that we were carefully calculating
this flag and then ignoring it, but I guess we just have
to treat the reason as lost in the mists of time (as you say,
according to the git history it has always been this way..)

-- PMM
diff mbox

Patch

diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c
index ac8c486..62ebc7e 100644
--- a/linux-user/linuxload.c
+++ b/linux-user/linuxload.c
@@ -26,22 +26,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[NGROUPS];
-
-    ngroup = getgroups(NGROUPS, grouplist);
-    for(i = 0; i < ngroup; i++) {
-	if(grouplist[i] == g) {
-	    return 1;
-	}
-    }
-    return 0;
-}
-
 static int count(char ** vec)
 {
     int		i;
@@ -57,7 +41,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);
@@ -73,14 +57,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? */
@@ -91,9 +71,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;
-	}
     }

     retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE);