From: Yu Watanabe Date: Sat, 12 Jul 2025 19:48:23 +0000 (+0900) Subject: quotacheck: drop unnecessary use of global variable X-Git-Tag: v258-rc1~48^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5a017becf8ecda2af4f6ebe080b00744fe7855b;p=thirdparty%2Fsystemd.git quotacheck: drop unnecessary use of global variable --- 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 };