1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibCore: Add syscall wrapper for dup2()

This commit is contained in:
Andreas Kling 2021-11-24 22:36:28 +01:00
parent 71bc9bee0a
commit a152b1f215
2 changed files with 9 additions and 0 deletions

View file

@ -179,4 +179,12 @@ ErrorOr<void> kill(pid_t pid, int signal)
return {};
}
ErrorOr<int> dup2(int source_fd, int destination_fd)
{
int fd = ::dup2(source_fd, destination_fd);
if (fd < 0)
return Error::from_syscall("dup2"sv, -errno);
return fd;
}
}