mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
LibC: Add addchdir() / addfchdir() to posix_spawn file actions
This isn't in posix yet, but it is implemented on some platforms and it will be in a future version: https://www.austingroupbugs.net/view.php?id=1208
This commit is contained in:
parent
2ddca326be
commit
5208856688
2 changed files with 14 additions and 0 deletions
|
@ -147,6 +147,18 @@ int posix_spawnp(pid_t* out_pid, const char* path, const posix_spawn_file_action
|
|||
posix_spawn_child(path, file_actions, attr, argv, envp, execvpe);
|
||||
}
|
||||
|
||||
int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t* actions, const char* path)
|
||||
{
|
||||
actions->state->actions.append([path]() { return chdir(path); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t* actions, int fd)
|
||||
{
|
||||
actions->state->actions.append([fd]() { return fchdir(fd); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t* actions, int fd)
|
||||
{
|
||||
actions->state->actions.append([fd]() { return close(fd); });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue