annotate tests/test-posix_spawn4.c @ 39848:b7ec445e40de

posix_spawn tests: Fix link error on 64-bit Cygwin. * tests/test-posix_spawn1.c (environ): Remove declaration. * tests/test-posix_spawn2.c (environ): Likewise. * tests/test-posix_spawn3.c (environ): Likewise. * tests/test-posix_spawn4.c (environ): Likewise. * modules/posix_spawn-tests (Depends-on): Add 'environ'. * modules/posix_spawnp-tests (Depends-on): Likewise.
author Bruno Haible <bruno@clisp.org>
date Tue, 18 Sep 2018 20:18:38 +0200
parents aa6d47aae153
children b06060465f09
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39829
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of posix_spawn() function with 'chdir' action.
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2008-2018 Free Software Foundation, Inc.
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2018. */
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <spawn.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <errno.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <fcntl.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #include <signal.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include <stdbool.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #include <stdio.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #include <stdlib.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 #include <string.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #include <unistd.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 #include <sys/types.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 #include <sys/wait.h>
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 static int
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 fd_safer (int fd)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 if (0 <= fd && fd <= 2)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 int f = fd_safer (dup (fd));
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 int e = errno;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 close (fd);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 errno = e;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 fd = f;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 return fd;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 int
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 main ()
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 char *argv[2] = { (char *) "pwd", NULL };
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 int ifd[2];
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 sigset_t blocked_signals;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 sigset_t fatal_signal_set;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 posix_spawn_file_actions_t actions;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 bool actions_allocated;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 posix_spawnattr_t attrs;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 bool attrs_allocated;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 int err;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 pid_t child;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 int fd;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 FILE *fp;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 char line[80];
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 int status;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 int exitstatus;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 if (pipe (ifd) < 0 || (ifd[0] = fd_safer (ifd[0])) < 0)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 perror ("cannot create pipe");
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 sigprocmask (SIG_SETMASK, NULL, &blocked_signals);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 sigemptyset (&fatal_signal_set);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 sigaddset (&fatal_signal_set, SIGINT);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 sigaddset (&fatal_signal_set, SIGTERM);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 sigaddset (&fatal_signal_set, SIGHUP);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 sigaddset (&fatal_signal_set, SIGPIPE);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 actions_allocated = false;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 attrs_allocated = false;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 if ((err = posix_spawn_file_actions_init (&actions)) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 || (actions_allocated = true,
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 (err = posix_spawn_file_actions_adddup2 (&actions, ifd[1], STDOUT_FILENO)) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 || (err = posix_spawn_file_actions_addclose (&actions, ifd[1])) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 || (err = posix_spawn_file_actions_addclose (&actions, ifd[0])) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 || (err = posix_spawn_file_actions_addopen (&actions, STDIN_FILENO, "/dev/null", O_RDONLY, 0)) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 || (err = posix_spawn_file_actions_addchdir (&actions, "/")) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 || (err = posix_spawnattr_init (&attrs)) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 || (attrs_allocated = true,
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 (err = posix_spawnattr_setsigmask (&attrs, &blocked_signals)) != 0
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 || (err = posix_spawnattr_setflags (&attrs, POSIX_SPAWN_SETSIGMASK)) != 0)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 || (err = posix_spawnp (&child, "pwd", &actions, &attrs, argv, environ)) != 0))
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 if (actions_allocated)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 posix_spawn_file_actions_destroy (&actions);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 if (attrs_allocated)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 posix_spawnattr_destroy (&attrs);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 errno = err;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 perror ("subprocess failed");
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 posix_spawn_file_actions_destroy (&actions);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 posix_spawnattr_destroy (&attrs);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 close (ifd[1]);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 fd = ifd[0];
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 fp = fdopen (fd, "r");
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 if (fp == NULL)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 fprintf (stderr, "fdopen() failed\n");
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 if (fread (line, 1, 80, fp) < 2)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 fprintf (stderr, "could not read expected output\n");
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 if (memcmp (line, "/\n", 2) != 0)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 fprintf (stderr, "read output is not the expected output");
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 fclose (fp);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 status = 0;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 while (waitpid (child, &status, 0) != child)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 ;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 if (!WIFEXITED (status))
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 exitstatus = WEXITSTATUS (status);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 if (exitstatus != 0)
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 {
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 exit (1);
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 }
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 return 0;
aa6d47aae153 posix_spawn_file_actions_addchdir: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 }