From: David Tardon Date: Fri, 25 Apr 2025 12:36:02 +0000 (+0200) Subject: udevadm-info: shorten the code a bit X-Git-Tag: v258-rc1~660^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ea3c1fb9eaa709af1d38866a570b0156e3dd7a4;p=thirdparty%2Fsystemd.git udevadm-info: shorten the code a bit --- 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);