Cut-n-paste strikes again
[oweals/busybox.git] / shell / lash.c
index d2d4298fb3eef058085e0b1592d8f883e53a8672..f454e699084beb1afda05b521a7a54d1c13c5451 100644 (file)
@@ -656,6 +656,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
                if (openfd != redir->fd) {
                        if (squirrel && redir->fd < 3) {
                                squirrel[redir->fd] = dup(redir->fd);
+                               fcntl (squirrel[redir->fd], F_SETFD, FD_CLOEXEC);
                        }
                        dup2(openfd, redir->fd);
                        close(openfd);
@@ -1275,15 +1276,6 @@ static int pseudo_exec(struct child_prog *child)
         */
        name = child->argv[0];
 
-#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
-       /* If you enable CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN, then
-        * if you run /bin/cat, it will use BusyBox cat even if
-        * /bin/cat exists on the filesystem and is _not_ busybox.
-        * Some systems want this, others do not.  Choose wisely.  :-)
-        */
-       name = bb_get_last_path_component(name);
-#endif
-
        {
            char** argv_l=child->argv;
            int argc_l;
@@ -1389,7 +1381,7 @@ static int run_command(struct job *newjob, int inbg, int outpipe[2])
                        }
                }
 
-#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
+#if !defined(__UCLIBC__) || defined(__ARCH_HAS_MMU__)
                if (!(child->pid = fork()))
 #else
                if (!(child->pid = vfork()))
@@ -1668,7 +1660,7 @@ int lash_main(int argc_l, char **argv_l)
         *    standard output is a terminal
         *    Refer to Posix.2, the description of the `sh' utility. */
        if (argv[optind]==NULL && input==stdin &&
-                       isatty(fileno(stdin)) && isatty(fileno(stdout))) {
+                       isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
                interactive=TRUE;
        }
        setup_job_control();