#define FDOP_CLOSE 1 #define FDOP_DUP2 2 #define FDOP_OPEN 3 #define FDOP_CHDIR 4 #define FDOP_FCHDIR 5 #define malloc __libc_malloc #define calloc __libc_calloc #define realloc undef #define free __libc_free static inline int faexpand(posix_spawn_file_actions_t *fa, size_t str) { posix_spawn_file_actions_t *n, *blk; blk = malloc(sizeof(*blk)+str); if (!blk) return -1; *blk = *fa; if (fa->__actions) { n = fa->__actions; blk->__actions = n->__actions; n->__actions = blk; } else blk->__actions = blk; fa->__actions = blk; fa->__pad0[0] = 0; return 0; }