diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-12-03 13:47:19 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-02-09 17:57:41 +0100 |
commit | 37ee46f7c859cb514592eb0ff8e11fc44316ef52 (patch) | |
tree | 3c18b2a277b58b44f6f2f97b12676cf897a5cab6 | |
parent | Merge pull request #31243 from YHNdnzj/systemctl-disable-now-template (diff) | |
download | systemd-37ee46f7c859cb514592eb0ff8e11fc44316ef52.tar.xz systemd-37ee46f7c859cb514592eb0ff8e11fc44316ef52.zip |
sysusers,tmpfiles: clarify error message for --replace
I was trying to run sysusers --replace, but the input file didn't have the right
suffix, and the message was very confusing. Let's split the message in two to
make it clearer that we care about the extension.
-rw-r--r-- | src/sysusers/sysusers.c | 8 | ||||
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 96fb6f8ad5..19284217f7 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -2140,10 +2140,12 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_REPLACE: - if (!path_is_absolute(optarg) || - !endswith(optarg, ".conf")) + if (!path_is_absolute(optarg)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "The argument to --replace= must an absolute path to a config file"); + "The argument to --replace= must be an absolute path."); + if (!endswith(optarg, ".conf")) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "The argument to --replace= must have the extension '.conf'."); arg_replace = optarg; break; diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index dbe9156f06..9fc8dad325 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -4167,10 +4167,12 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_REPLACE: - if (!path_is_absolute(optarg) || - !endswith(optarg, ".conf")) + if (!path_is_absolute(optarg)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "The argument to --replace= must an absolute path to a config file"); + "The argument to --replace= must be an absolute path."); + if (!endswith(optarg, ".conf")) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "The argument to --replace= must have the extension '.conf'."); arg_replace = optarg; break; |