/*
* verify that soft limit is higher than NUM_NEEDED,
- * number of file descriptors we would try to open
- * plus SAFETY_MARGIN to not exhaust file pool
+ * which is the number of file descriptors we would
+ * try to open plus SAFETY_MARGIN to not exhaust the
+ * file descriptor pool
*/
num_open.rlim_cur = NUM_NEEDED;
if (!memchunk) {
store_errmsg("memchunk, malloc() failed", our_errno());
fprintf(stderr, "%s\n", msgbuff);
- return -7;
+ return -5;
}
/* initialize it to fight lazy allocation */
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
- return -8;
+ return -6;
}
/* allocate array for file descriptors */
store_errmsg("fd, malloc() failed", our_errno());
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
- return -9;
+ return -7;
}
/* initialize it to fight lazy allocation */
free(fd);
fd = NULL;
free(memchunk);
- return -10;
+ return -8;
}
/* create a bunch of file descriptors */
free(fd);
fd = NULL;
free(memchunk);
- return -11;
+ return -9;
}
free(memchunk);
/* close file descriptors unless instructed to keep them */
+
if (!keep_open) {
close_file_descriptors();
}