Loading tests/libtest/lib518.c +9 −7 Original line number Original line Diff line number Diff line Loading @@ -188,8 +188,9 @@ static int rlimit(int keep_open) /* /* * verify that soft limit is higher than NUM_NEEDED, * verify that soft limit is higher than NUM_NEEDED, * number of file descriptors we would try to open * which is the number of file descriptors we would * plus SAFETY_MARGIN to not exhaust file pool * try to open plus SAFETY_MARGIN to not exhaust the * file descriptor pool */ */ num_open.rlim_cur = NUM_NEEDED; num_open.rlim_cur = NUM_NEEDED; Loading Loading @@ -226,7 +227,7 @@ static int rlimit(int keep_open) if (!memchunk) { if (!memchunk) { store_errmsg("memchunk, malloc() failed", our_errno()); store_errmsg("memchunk, malloc() failed", our_errno()); fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff); return -7; return -5; } } /* initialize it to fight lazy allocation */ /* initialize it to fight lazy allocation */ Loading @@ -247,7 +248,7 @@ static int rlimit(int keep_open) store_errmsg(strbuff, 0); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff); free(memchunk); free(memchunk); return -8; return -6; } } /* allocate array for file descriptors */ /* allocate array for file descriptors */ Loading @@ -260,7 +261,7 @@ static int rlimit(int keep_open) store_errmsg("fd, malloc() failed", our_errno()); store_errmsg("fd, malloc() failed", our_errno()); fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff); free(memchunk); free(memchunk); return -9; return -7; } } /* initialize it to fight lazy allocation */ /* initialize it to fight lazy allocation */ Loading @@ -283,7 +284,7 @@ static int rlimit(int keep_open) free(fd); free(fd); fd = NULL; fd = NULL; free(memchunk); free(memchunk); return -10; return -8; } } /* create a bunch of file descriptors */ /* create a bunch of file descriptors */ Loading Loading @@ -313,7 +314,7 @@ static int rlimit(int keep_open) free(fd); free(fd); fd = NULL; fd = NULL; free(memchunk); free(memchunk); return -11; return -9; } } Loading @@ -328,6 +329,7 @@ static int rlimit(int keep_open) free(memchunk); free(memchunk); /* close file descriptors unless instructed to keep them */ /* close file descriptors unless instructed to keep them */ if (!keep_open) { if (!keep_open) { close_file_descriptors(); close_file_descriptors(); } } Loading Loading
tests/libtest/lib518.c +9 −7 Original line number Original line Diff line number Diff line Loading @@ -188,8 +188,9 @@ static int rlimit(int keep_open) /* /* * verify that soft limit is higher than NUM_NEEDED, * verify that soft limit is higher than NUM_NEEDED, * number of file descriptors we would try to open * which is the number of file descriptors we would * plus SAFETY_MARGIN to not exhaust file pool * try to open plus SAFETY_MARGIN to not exhaust the * file descriptor pool */ */ num_open.rlim_cur = NUM_NEEDED; num_open.rlim_cur = NUM_NEEDED; Loading Loading @@ -226,7 +227,7 @@ static int rlimit(int keep_open) if (!memchunk) { if (!memchunk) { store_errmsg("memchunk, malloc() failed", our_errno()); store_errmsg("memchunk, malloc() failed", our_errno()); fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff); return -7; return -5; } } /* initialize it to fight lazy allocation */ /* initialize it to fight lazy allocation */ Loading @@ -247,7 +248,7 @@ static int rlimit(int keep_open) store_errmsg(strbuff, 0); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff); free(memchunk); free(memchunk); return -8; return -6; } } /* allocate array for file descriptors */ /* allocate array for file descriptors */ Loading @@ -260,7 +261,7 @@ static int rlimit(int keep_open) store_errmsg("fd, malloc() failed", our_errno()); store_errmsg("fd, malloc() failed", our_errno()); fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff); free(memchunk); free(memchunk); return -9; return -7; } } /* initialize it to fight lazy allocation */ /* initialize it to fight lazy allocation */ Loading @@ -283,7 +284,7 @@ static int rlimit(int keep_open) free(fd); free(fd); fd = NULL; fd = NULL; free(memchunk); free(memchunk); return -10; return -8; } } /* create a bunch of file descriptors */ /* create a bunch of file descriptors */ Loading Loading @@ -313,7 +314,7 @@ static int rlimit(int keep_open) free(fd); free(fd); fd = NULL; fd = NULL; free(memchunk); free(memchunk); return -11; return -9; } } Loading @@ -328,6 +329,7 @@ static int rlimit(int keep_open) free(memchunk); free(memchunk); /* close file descriptors unless instructed to keep them */ /* close file descriptors unless instructed to keep them */ if (!keep_open) { if (!keep_open) { close_file_descriptors(); close_file_descriptors(); } } Loading