1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

Shell: Fix incorrect fcntl usage

FD_CLOEXEC is a file descriptor flag, so one must use F_{G,S}ETFD
instead.
This commit is contained in:
sin-ack 2021-05-13 08:01:47 +00:00 committed by Linus Groh
parent fd80e7a339
commit f248145e64

View file

@ -2118,8 +2118,8 @@ SavedFileDescriptors::SavedFileDescriptors(const NonnullRefPtrVector<AST::Rewiri
continue;
}
auto flags = fcntl(new_fd, F_GETFL);
auto rc = fcntl(new_fd, F_SETFL, flags | FD_CLOEXEC);
auto flags = fcntl(new_fd, F_GETFD);
auto rc = fcntl(new_fd, F_SETFD, flags | FD_CLOEXEC);
VERIFY(rc == 0);
m_saves.append({ rewiring.new_fd, new_fd });