| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: eval.c,v 1.178 2020/02/04 16:06:59 kre Exp $ */ | | 1 | /* $NetBSD: eval.c,v 1.179 2020/04/23 09:01:33 kre Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1993 | | 4 | * Copyright (c) 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Kenneth Almquist. | | 8 | * Kenneth Almquist. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #ifndef lint | | 36 | #ifndef lint |
37 | #if 0 | | 37 | #if 0 |
38 | static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; | | 38 | static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; |
39 | #else | | 39 | #else |
40 | __RCSID("$NetBSD: eval.c,v 1.178 2020/02/04 16:06:59 kre Exp $"); | | 40 | __RCSID("$NetBSD: eval.c,v 1.179 2020/04/23 09:01:33 kre Exp $"); |
41 | #endif | | 41 | #endif |
42 | #endif /* not lint */ | | 42 | #endif /* not lint */ |
43 | | | 43 | |
44 | #include <stdbool.h> | | 44 | #include <stdbool.h> |
45 | #include <stdlib.h> | | 45 | #include <stdlib.h> |
46 | #include <signal.h> | | 46 | #include <signal.h> |
47 | #include <stdio.h> | | 47 | #include <stdio.h> |
48 | #include <string.h> | | 48 | #include <string.h> |
49 | #include <errno.h> | | 49 | #include <errno.h> |
50 | #include <limits.h> | | 50 | #include <limits.h> |
51 | #include <unistd.h> | | 51 | #include <unistd.h> |
52 | #include <sys/fcntl.h> | | 52 | #include <sys/fcntl.h> |
53 | #include <sys/stat.h> | | 53 | #include <sys/stat.h> |
| @@ -761,27 +761,26 @@ evalbackcmd(union node *n, struct backcm | | | @@ -761,27 +761,26 @@ evalbackcmd(union node *n, struct backcm |
761 | exitstatus = oexitstatus; /* XXX o... no longer exists */ | | 761 | exitstatus = oexitstatus; /* XXX o... no longer exists */ |
762 | evalcommand(n, EV_BACKCMD, result); | | 762 | evalcommand(n, EV_BACKCMD, result); |
763 | } else | | 763 | } else |
764 | #endif | | 764 | #endif |
765 | { | | 765 | { |
766 | INTOFF; | | 766 | INTOFF; |
767 | if (sh_pipe(pip) < 0) | | 767 | if (sh_pipe(pip) < 0) |
768 | error("Pipe call failed"); | | 768 | error("Pipe call failed"); |
769 | jp = makejob(n, 1); | | 769 | jp = makejob(n, 1); |
770 | if (forkshell(jp, n, FORK_NOJOB) == 0) { | | 770 | if (forkshell(jp, n, FORK_NOJOB) == 0) { |
771 | FORCEINTON; | | 771 | FORCEINTON; |
772 | close(pip[0]); | | 772 | close(pip[0]); |
773 | movefd(pip[1], 1); | | 773 | movefd(pip[1], 1); |
774 | eflag = 0; | | | |
775 | evaltree(n, EV_EXIT); | | 774 | evaltree(n, EV_EXIT); |
776 | /* NOTREACHED */ | | 775 | /* NOTREACHED */ |
777 | } | | 776 | } |
778 | close(pip[1]); | | 777 | close(pip[1]); |
779 | result->fd = pip[0]; | | 778 | result->fd = pip[0]; |
780 | result->jp = jp; | | 779 | result->jp = jp; |
781 | INTON; | | 780 | INTON; |
782 | } | | 781 | } |
783 | popstackmark(&smark); | | 782 | popstackmark(&smark); |
784 | out: | | 783 | out: |
785 | CTRACE(DBG_EVAL, ("evalbackcmd done: fd=%d buf=0x%x nleft=%d jp=0x%x\n", | | 784 | CTRACE(DBG_EVAL, ("evalbackcmd done: fd=%d buf=0x%x nleft=%d jp=0x%x\n", |
786 | result->fd, result->buf, result->nleft, result->jp)); | | 785 | result->fd, result->buf, result->nleft, result->jp)); |
787 | } | | 786 | } |