summaryrefslogtreecommitdiff
path: root/src/test/test-libudev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-libudev.c')
-rw-r--r--src/test/test-libudev.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 293c151d42..34c49b969a 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -19,13 +19,8 @@
***/
#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
-#include <string.h>
#include <getopt.h>
-#include <fcntl.h>
#include <sys/epoll.h>
#include "libudev.h"
@@ -309,6 +304,7 @@ static int test_queue(struct udev *udev) {
static int test_enumerate(struct udev *udev, const char *subsystem) {
struct udev_enumerate *udev_enumerate;
+ int r;
printf("enumerate '%s'\n", subsystem == NULL ? "<all>" : subsystem);
udev_enumerate = udev_enumerate_new(udev);
@@ -344,7 +340,11 @@ static int test_enumerate(struct udev *udev, const char *subsystem) {
if (udev_enumerate == NULL)
return -1;
udev_enumerate_add_match_subsystem(udev_enumerate,"block");
- udev_enumerate_add_match_is_initialized(udev_enumerate);
+ r = udev_enumerate_add_match_is_initialized(udev_enumerate);
+ if (r < 0) {
+ udev_enumerate_unref(udev_enumerate);
+ return r;
+ }
udev_enumerate_scan_devices(udev_enumerate);
test_enumerate_print_list(udev_enumerate);
udev_enumerate_unref(udev_enumerate);