From 8ea3c1fb9eaa709af1d38866a570b0156e3dd7a4 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 25 Apr 2025 14:36:02 +0200 Subject: [PATCH] udevadm-info: shorten the code a bit --- src/udev/udevadm-info.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index 373ecdbe5d5..17fd33f45c6 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -689,7 +689,7 @@ static void cleanup_dirs_after_db_cleanup(DIR *dir, DIR *datadir) { } } -static void cleanup_db(void) { +static int cleanup_db(void) { _cleanup_closedir_ DIR *dir1 = NULL, *dir2 = NULL, *dir3 = NULL, *dir4 = NULL; dir1 = opendir("/run/udev/data"); @@ -710,6 +710,8 @@ static void cleanup_db(void) { /* Do not remove /run/udev/watch. It will be handled by udevd well on restart. * And should not be removed by external program when udevd is running. */ + + return 0; } static int query_device(QueryType query, sd_device* device) { @@ -1278,10 +1280,8 @@ int info_main(int argc, char *argv[], void *userdata) { if (r <= 0) return r; - if (arg_action_type == ACTION_CLEANUP_DB) { - cleanup_db(); - return 0; - } + if (arg_action_type == ACTION_CLEANUP_DB) + return cleanup_db(); if (arg_action_type == ACTION_DEVICE_ID_FILE) return stat_device(arg_name, arg_export, arg_export_prefix); -- 2.47.3