OLD | NEW |
1 #include <spawn.h> | 1 #include <spawn.h> |
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <string.h> | 3 #include <string.h> |
4 #include <errno.h> | 4 #include <errno.h> |
5 #include "fdop.h" | 5 #include "fdop.h" |
6 | 6 |
7 int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *restrict fa, in
t fd, const char *restrict path, int flags, mode_t mode) | 7 int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* restrict fa, |
8 { | 8 int fd, |
9 » struct fdop *op = malloc(sizeof *op + strlen(path) + 1); | 9 const char* restrict path, |
10 » if (!op) return ENOMEM; | 10 int flags, |
11 » op->cmd = FDOP_OPEN; | 11 mode_t mode) { |
12 » op->fd = fd; | 12 struct fdop* op = malloc(sizeof *op + strlen(path) + 1); |
13 » op->oflag = flags; | 13 if (!op) |
14 » op->mode = mode; | 14 return ENOMEM; |
15 » strcpy(op->path, path); | 15 op->cmd = FDOP_OPEN; |
16 » if ((op->next = fa->__actions)) op->next->prev = op; | 16 op->fd = fd; |
17 » op->prev = 0; | 17 op->oflag = flags; |
18 » fa->__actions = op; | 18 op->mode = mode; |
19 » return 0; | 19 strcpy(op->path, path); |
| 20 if ((op->next = fa->__actions)) |
| 21 op->next->prev = op; |
| 22 op->prev = 0; |
| 23 fa->__actions = op; |
| 24 return 0; |
20 } | 25 } |
OLD | NEW |