summaryrefslogtreecommitdiffstats
path: root/src/quotacheck
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-03-10 16:11:47 +0100
committerMike Yuan <me@yhndnzj.com>2024-03-10 16:11:47 +0100
commitb2d4ce7e587e7cb97107ac1be8bf25b168716dfc (patch)
tree32f413038d6414fbca3ba1a34d33f274b650cd9a /src/quotacheck
parentquotacheck: minor modernization (diff)
downloadsystemd-b2d4ce7e587e7cb97107ac1be8bf25b168716dfc.tar.xz
systemd-b2d4ce7e587e7cb97107ac1be8bf25b168716dfc.zip
quotacheck: store argv[*] in static var
As per our coding style
Diffstat (limited to 'src/quotacheck')
-rw-r--r--src/quotacheck/quotacheck.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c
index d049f5364b..d46f280bf4 100644
--- a/src/quotacheck/quotacheck.c
+++ b/src/quotacheck/quotacheck.c
@@ -12,11 +12,15 @@
#include "proc-cmdline.h"
#include "process-util.h"
#include "signal-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")) {
@@ -56,8 +60,6 @@ static void test_files(void) {
static int run(int argc, char *argv[]) {
int r;
- _cleanup_free_ char *fspath = NULL;
- bool quota_check_all = false;
log_setup();
@@ -89,21 +91,19 @@ static int run(int argc, char *argv[]) {
}
if (argc == 2) {
- fspath = strdup(argv[1]);
- if (!fspath)
+ arg_path = strdup(argv[1]);
+ if (!arg_path)
return log_oom();
- } else
- quota_check_all = true;
+ }
r = safe_fork("(quotacheck)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM|FORK_RLIMIT_NOFILE_SAFE|FORK_WAIT|FORK_LOG, NULL);
if (r < 0)
return r;
-
if (r == 0) {
const char *cmdline[] = {
QUOTACHECK,
- quota_check_all ? "-anug" : "-nug",
- fspath,
+ arg_path ? "-nug" : "-anug", /* Check all file systems if path isn't specified */
+ arg_path,
NULL
};