]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm-info: shorten the code a bit
authorDavid Tardon <dtardon@redhat.com>
Fri, 25 Apr 2025 12:36:02 +0000 (14:36 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 9 May 2025 03:14:21 +0000 (12:14 +0900)
src/udev/udevadm-info.c

index 373ecdbe5d532c1a72edab323322aa6f6aa43ea0..17fd33f45c62a3ff10cec20a91e8a7f1ed3e7065 100644 (file)
@@ -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);