274 |
break; |
break; |
275 |
default: |
default: |
276 |
pathname[pos2] = pathname[pos]; |
pathname[pos2] = pathname[pos]; |
277 |
pos2++; |
pos2++; |
278 |
} |
} |
279 |
pos++; |
pos++; |
280 |
} |
} |
1016 |
exit(1); |
exit(1); |
1017 |
} |
} |
1018 |
|
|
1019 |
|
/* close file descriptors * |
1020 |
|
************************************************************************/ |
1021 |
|
|
1022 |
|
// try to close all non-terminal file descriptors. |
1023 |
|
|
1024 |
|
void fd_closeall_nonterminal(void) |
1025 |
|
{ |
1026 |
|
int count, maxfilefd = 1024; |
1027 |
|
#ifdef RLIMIT_NPROC |
1028 |
|
struct rlimit lim; |
1029 |
|
|
1030 |
|
getrlimit(RLIMIT_NOFILE, &lim); |
1031 |
|
maxfilefd = lim.rlim_max; |
1032 |
|
#endif |
1033 |
|
for (count = 3; count < maxfilefd; count++) |
1034 |
|
close(count); |
1035 |
|
} |