Deleted Added
full compact
posix_spawn.c (223907) posix_spawn.c (287292)
1/*-
2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libc/gen/posix_spawn.c 223907 2011-07-10 14:20:11Z jilles $");
28__FBSDID("$FreeBSD: head/lib/libc/gen/posix_spawn.c 287292 2015-08-29 14:25:01Z kib $");
29
30#include "namespace.h"
31#include <sys/queue.h>
32#include <sys/wait.h>
33
34#include <errno.h>
35#include <fcntl.h>
36#include <sched.h>

--- 76 unchanged lines hidden (view full) ---

113 /* Reset user ID's */
114 if (sa->sa_flags & POSIX_SPAWN_RESETIDS) {
115 if (setegid(getgid()) != 0)
116 return (errno);
117 if (seteuid(getuid()) != 0)
118 return (errno);
119 }
120
29
30#include "namespace.h"
31#include <sys/queue.h>
32#include <sys/wait.h>
33
34#include <errno.h>
35#include <fcntl.h>
36#include <sched.h>

--- 76 unchanged lines hidden (view full) ---

113 /* Reset user ID's */
114 if (sa->sa_flags & POSIX_SPAWN_RESETIDS) {
115 if (setegid(getgid()) != 0)
116 return (errno);
117 if (seteuid(getuid()) != 0)
118 return (errno);
119 }
120
121 /* Set signal masks/defaults */
121 /*
122 * Set signal masks/defaults.
123 * Use unwrapped syscall, libthr is in undefined state after vfork().
124 */
122 if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) {
125 if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) {
123 _sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
126 __libc_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
124 }
125
126 if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
127 for (i = 1; i <= _SIG_MAXSIG; i++) {
128 if (sigismember(&sa->sa_sigdefault, i))
127 }
128
129 if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
130 for (i = 1; i <= _SIG_MAXSIG; i++) {
131 if (sigismember(&sa->sa_sigdefault, i))
129 if (_sigaction(i, &sigact, NULL) != 0)
132 if (__libc_sigaction(i, &sigact, NULL) != 0)
130 return (errno);
131 }
132 }
133
134 return (0);
135}
136
137static int

--- 338 unchanged lines hidden ---
133 return (errno);
134 }
135 }
136
137 return (0);
138}
139
140static int

--- 338 unchanged lines hidden ---