tests: move the closedir() call
authorBartosz Golaszewski <bartekgola@gmail.com>
Thu, 23 Feb 2017 10:51:00 +0000 (11:51 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Thu, 23 Feb 2017 10:51:00 +0000 (11:51 +0100)
Close the directory immediately after the loop iterating over
its entries ends.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/unit/gpiod-unit.c

index 51b59455a16f5f328c89fe7a15145d2a2669ceaa..4e0e6ccce96bdb9b5c5a5da76ee1508bb135ad58 100644 (file)
@@ -379,13 +379,12 @@ static void test_prepare(struct gu_chip_descr *descr)
                                die("unable to determine the chip number");
                }
        }
+       closedir(dir);
 
        if (descr->num_chips != current)
                die("number of requested and detected mockup gpiochips is not the same");
 
        qsort(ctx->chips, ctx->num_chips, sizeof(*ctx->chips), chipcmp);
-
-       closedir(dir);
 }
 
 static void test_teardown(void)