summaryrefslogtreecommitdiff
path: root/test/test-udev.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2014-08-05 10:46:11 -0400
committerAnthony G. Basile <blueness@gentoo.org>2014-08-05 10:46:11 -0400
commite35ef44ebe788aaffd1f6910750492bacaba7b6f (patch)
tree9f998ea056a6d8c744fca8b4a58dcc881d26d722 /test/test-udev.c
parent32ac9623351023f99e98ccc44fa53b86c282be27 (diff)
test: use _cleanup_ attribute
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'test/test-udev.c')
-rw-r--r--test/test-udev.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/test/test-udev.c b/test/test-udev.c
index fd4388a678..b3ff9a94cc 100644
--- a/test/test-udev.c
+++ b/test/test-udev.c
@@ -31,9 +31,10 @@
#include <sched.h>
#include <sys/mount.h>
#include <sys/signalfd.h>
-#include <linux/fs.h>
+#include "missing.h"
#include "udev.h"
+#include "udev-util.h"
#ifndef HAVE_UNSHARE
#include <sys/syscall.h>
@@ -91,10 +92,10 @@ out:
}
int main(int argc, char *argv[]) {
- struct udev *udev = NULL;
- struct udev_event *event = NULL;
- struct udev_device *dev = NULL;
- struct udev_rules *rules = NULL;
+ _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_udev_event_unref_ struct udev_event *event = NULL;
+ _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL;
char syspath[UTIL_PATH_SIZE];
const char *devpath;
const char *action;
@@ -169,10 +170,7 @@ int main(int argc, char *argv[]) {
out:
if (event != NULL && event->fd_signal >= 0)
close(event->fd_signal);
- udev_event_unref(event);
- udev_device_unref(dev);
- udev_rules_unref(rules);
label_finish();
- udev_unref(udev);
+
return err ? EXIT_FAILURE : EXIT_SUCCESS;
}