Larry's variant on Evin Robertson's fix to what I messed up
[oweals/busybox.git] / shell / hush.c
index 71e40489dd8699d4322c30b5edefffdd01ad1ec1..b8e4a55c26bf8914114306ccce6ffd2a1b51f112 100644 (file)
@@ -1185,7 +1185,7 @@ static int run_pipe_real(struct pipe *pi)
        pi->pgrp = 0;
 
        /* Check if we are supposed to run in the foreground */
-       if (pi->followup!=PIPE_BG) {
+       if (interactive && pi->followup!=PIPE_BG) {
                if ((pi->pgrp = tcgetpgrp(ctty = 2)) < 0
                                && (pi->pgrp = tcgetpgrp(ctty = 0)) < 0
                                && (pi->pgrp = tcgetpgrp(ctty = 1)) < 0)
@@ -1660,7 +1660,6 @@ int reserved_word(o_string *dest, struct p_context *ctx)
                                old->child->group = ctx->list_head;
                                *ctx = *old;   /* physical copy */
                                free(old);
-                               ctx->w=RES_NONE;
                        }
                        b_reset (dest);
                        return 1;