udevadm-info: shorten the code a bit
This commit is contained in:
committed by
Yu Watanabe
parent
31767b92a0
commit
8ea3c1fb9e
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user