From 1ca208fb4f93e5869704af1812cbff7130a2fc03 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sat, 12 Oct 2013 20:28:21 -0400 Subject: Introduce udev object cleanup functions --- src/fsck/fsck.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/fsck') diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index f298cf7b9a..96a79ddcdb 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -27,7 +27,6 @@ #include #include -#include #include #include "util.h" @@ -36,6 +35,8 @@ #include "bus-errors.h" #include "virt.h" #include "fileio.h" +#include "libudev.h" +#include "udev-util.h" static bool arg_skip = false; static bool arg_force = false; @@ -251,8 +252,8 @@ int main(int argc, char *argv[]) { int i = 0, r = EXIT_FAILURE, q; pid_t pid; siginfo_t status; - struct udev *udev = NULL; - struct udev_device *udev_device = NULL; + _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL; const char *device; bool root_directory; int progress_pipe[2] = { -1, -1 }; @@ -400,12 +401,6 @@ int main(int argc, char *argv[]) { touch("/run/systemd/quotacheck"); finish: - if (udev_device) - udev_device_unref(udev_device); - - if (udev) - udev_unref(udev); - close_pipe(progress_pipe); return r; -- cgit v1.2.3-54-g00ecf