From e5a017becf8ecda2af4f6ebe080b00744fe7855b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 13 Jul 2025 04:48:23 +0900 Subject: [PATCH] quotacheck: drop unnecessary use of global variable --- src/quotacheck/quotacheck.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c index 23a5f414c5c..b98819f0efe 100644 --- a/src/quotacheck/quotacheck.c +++ b/src/quotacheck/quotacheck.c @@ -7,15 +7,11 @@ #include "main-func.h" #include "proc-cmdline.h" #include "process-util.h" -#include "static-destruct.h" #include "string-util.h" -static char *arg_path = NULL; static bool arg_skip = false; static bool arg_force = false; -STATIC_DESTRUCTOR_REGISTER(arg_path, freep); - static int parse_proc_cmdline_item(const char *key, const char *value, void *data) { if (streq(key, "quotacheck.mode")) { @@ -68,9 +64,10 @@ static int run(int argc, char *argv[]) { } } + _cleanup_free_ char *path = NULL; if (argc == 2) { - arg_path = strdup(argv[1]); - if (!arg_path) + path = strdup(argv[1]); + if (!path) return log_oom(); } @@ -80,8 +77,8 @@ static int run(int argc, char *argv[]) { if (r == 0) { const char *cmdline[] = { QUOTACHECK, - arg_path ? "-nug" : "-anug", /* Check all file systems if path isn't specified */ - arg_path, + path ? "-nug" : "-anug", /* Check all file systems if path isn't specified */ + path, NULL }; -- 2.47.3