127 |
static void set_sandbox(void) { |
static void set_sandbox(void) { |
128 |
|
|
129 |
int i; |
int i; |
130 |
|
int max_descriptors = 1024; |
131 |
struct stat st; |
struct stat st; |
132 |
extern char **environ; |
extern char **environ; |
133 |
char *path = "PATH=/bin:/usr/bin:/sbin:/usr/sbin"; |
char *path = "PATH=/bin:/usr/bin:/sbin:/usr/sbin"; |
148 |
} |
} |
149 |
|
|
150 |
/* |
/* |
151 |
* Require that the other file descriptios are closed. Should we use |
* Require that the other file descriptios are closed. Everything |
152 |
* sysconf() or getdtablesize() or getrlimit() or... |
* seems to have getdtablesize, so we'll use it here, and back |
153 |
|
* out to use 1024 if getdtablesize not available. |
154 |
*/ |
*/ |
155 |
for(i = 3; i < 1024; i++) |
#ifdef HAVE_UNISTD_H |
156 |
|
max_descriptors = getdtablesize(); |
157 |
|
#endif |
158 |
|
for(i = 3; i < max_descriptors; i++) |
159 |
(void) close(i); |
(void) close(i); |
160 |
errno= 0; |
errno= 0; |
161 |
|
|