fix backwards posix_spawn file action order
[musl] / src / process / posix_spawn_file_actions_addclose.c
index 44c6314..cdda597 100644 (file)
@@ -9,7 +9,8 @@ int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *fa, int fd)
        if (!op) return ENOMEM;
        op->cmd = FDOP_CLOSE;
        op->fd = fd;
-       op->next = fa->__actions;
+       if ((op->next = fa->__actions)) op->next->prev = op;
+       op->prev = 0;
        fa->__actions = op;
        return 0;
 }