chpst: fix a bug where -U USER was using wrong USER (one from -u USER)
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 29 Nov 2013 15:39:28 +0000 (16:39 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 29 Nov 2013 15:39:28 +0000 (16:39 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/inet_common.c
runit/chpst.c

index 0f4fca1a27c622a2987e2efd105fdf6c1ffe5831..b3e0802ee30e80a38f4e4520752b6d73ebb8887f 100644 (file)
@@ -175,8 +175,7 @@ int FAST_FUNC INET6_resolve(const char *name, struct sockaddr_in6 *sin6)
                return -1;
        }
        memcpy(sin6, ai->ai_addr, sizeof(*sin6));
-       if (ai)
-               freeaddrinfo(ai);
+       freeaddrinfo(ai);
        return 0;
 }
 
index ed72c8b8cdb7472d33331865f60f5fe66d7b54e5..71af29f66cf1440d01d1a9512a62c0273735685d 100644 (file)
@@ -236,7 +236,6 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
 {
        struct bb_uidgid_t ugid;
        char *set_user = set_user; /* for compiler */
-       char *env_user = env_user;
        char *env_dir = env_dir;
        char *root;
        char *nicestr;
@@ -264,7 +263,7 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
                        IF_CHPST("/:n:vP012"),
                        &limita, &limitc, &limitd, &limitf, &limitl,
                        &limitm, &limito, &limitp, &limitr, &limits, &limitt,
-                       &set_user, &env_user, &env_dir
+                       &set_user, &set_user, &env_dir
                        IF_CHPST(, &root, &nicestr));
                argv += optind;
                if (opt & OPT_m) { // -m means -asld
@@ -292,7 +291,7 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
 
        // envuidgid?
        if (ENABLE_ENVUIDGID && applet_name[0] == 'e' && applet_name[3] == 'u') {
-               env_user = *argv++;
+               set_user = *argv++;
                opt |= OPT_U;
        }