You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Make sure we close the file descriptor on exec. */
int flags = fcntl (fileno (mallstream), F_GETFD, 0);
if (flags >= 0) {
flags |= FD_CLOEXEC;
fcntl (fileno (mallstream), F_SETFD, flags);
}
We need to take care on file destructor to close the stream when an exe is spawned.
in init_exit.c on stdio folder there is a test when to close a file:
if (FLAG_IS_SET(__clib4->__fd[i]->fd_Flags, FDF_IN_USE) && FLAG_IS_CLEAR(__clib4->__fd[i]->fd_Flags, FDF_NO_CLOSE)) {
We can add a test on FDF_CLOEXEC there. However FDF_CLOEXEC is only set on pipe2 function and needs to be set also on fcntl
The text was updated successfully, but these errors were encountered:
When you have a piece of code like this:
We need to take care on file destructor to close the stream when an exe is spawned.
in init_exit.c on stdio folder there is a test when to close a file:
if (FLAG_IS_SET(__clib4->__fd[i]->fd_Flags, FDF_IN_USE) && FLAG_IS_CLEAR(__clib4->__fd[i]->fd_Flags, FDF_NO_CLOSE)) {
We can add a test on FDF_CLOEXEC there. However FDF_CLOEXEC is only set on pipe2 function and needs to be set also on fcntl
The text was updated successfully, but these errors were encountered: