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
{{ message }}
Repository navigation
File descriptor closing in spawn_process_os in libnative on Unix platforms misses file descriptors opened before lowered resource limits #13790
I know on BSD one can use closefrom and on Linux one can use /proc/self/fd.
The following code demonstrates how a file can be carried in over lowered resource limits.
#include<errno.h>#include<stdlib.h>#include<stdio.h>#include<string.h>#include<sys/time.h>#include<sys/resource.h>intmain() {
structrlimitconstlimit= {
.rlim_cur=0,
.rlim_max=0
};
if (-1==setrlimit(RLIMIT_NOFILE, &limit)) {
fprintf(stderr, "error: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
puts("Printing to standard output even though the resource limit is lowered past standard output's number!");
returnEXIT_SUCCESS;
}
Activity
alexcrichton commentedon Apr 28, 2014
Closing as a dupe of #12148.