summaryrefslogtreecommitdiff
path: root/src/process/posix_spawn.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-05-29 12:58:02 -0400
committerRich Felker <dalias@aerifal.cx>2011-05-29 12:58:02 -0400
commitf48832ee15027763826c8a7ff9eeed3fc06bb499 (patch)
treec22fc7561126476e81dfd1f985d4168726a8cfab /src/process/posix_spawn.c
parentdd45edb5ff6198493edf1315d3e4e6ffc7b96447 (diff)
downloadmusl-f48832ee15027763826c8a7ff9eeed3fc06bb499.tar.gz
fix backwards posix_spawn file action order
Diffstat (limited to 'src/process/posix_spawn.c')
-rw-r--r--src/process/posix_spawn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
index 59f4a8bb..b1a9fbde 100644
--- a/src/process/posix_spawn.c
+++ b/src/process/posix_spawn.c
@@ -51,10 +51,11 @@ int __posix_spawnx(pid_t *res, const char *path,
__syscall(SYS_setuid, __syscall(SYS_getuid)) ))
_exit(127);
- if (fa) {
+ if (fa && fa->__actions) {
struct fdop *op;
int ret, fd;
- for (op = fa->__actions; op; op = op->next) {
+ for (op = fa->__actions; op->next; op = op->next);
+ for (; op; op = op->prev) {
switch(op->cmd) {
case FDOP_CLOSE:
ret = __syscall(SYS_close, op->fd);