From: Masatake YAMATO Date: Fri, 23 Sep 2022 06:33:50 +0000 (+0900) Subject: tests: (mkfds) call close method of factory only when it is specified X-Git-Tag: v2.39-rc1~505^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01f7300b62b81efddd41dfabb15faa9d35b4ee45;p=thirdparty%2Futil-linux.git tests: (mkfds) call close method of factory only when it is specified Signed-off-by: Masatake YAMATO --- diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index 7906569064..994da2b77e 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -1111,8 +1111,10 @@ int main(int argc, char **argv) errx(EXIT_FAILURE, _("not enough file descriptors given for %s"), factory->name); - for (int i = 0; i < MAX_N; i++) + for (int i = 0; i < MAX_N; i++) { fdescs[i].fd = -1; + fdescs[i].close = NULL; + } for (int i = 0; i < factory->N; i++) { char *str = argv[optind + i]; @@ -1151,7 +1153,7 @@ int main(int argc, char **argv) pause(); for (int i = 0; i < factory->N + factory->EX_N; i++) - if (fdescs[i].fd >= 0) + if (fdescs[i].fd >= 0 && fdescs[i].close) fdescs[i].close(fdescs[i].fd, fdescs[i].data); if (factory->free)