diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-04-30 15:54:12 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-04-30 21:41:06 +0200 |
commit | 4e494e6aace40a356e646414b48f32c49ec7bbd8 (patch) | |
tree | 72b338f5285d0078c24446f301302e2ba6d8dab8 /src/creds | |
parent | build-path: fix SIGSEGV on RISC-V and MIPS (diff) | |
download | systemd-4e494e6aace40a356e646414b48f32c49ec7bbd8.tar.xz systemd-4e494e6aace40a356e646414b48f32c49ec7bbd8.zip |
tree-wise: several cleanups for logging
- drop unnecessary SYNTHETIC_ERRNO() when the logger does not propagate
error code,
- drop unnecessary '%m' in error message when the error code is
specified with SYNTHETIC_ERRNO(),
- add missing full stop at the end of log message,
- use RET_GATHER(),
- add missing ", ignoring.",
- upeercase the first letter, etc., etc...
Diffstat (limited to 'src/creds')
-rw-r--r-- | src/creds/creds.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/creds/creds.c b/src/creds/creds.c index c1ab0e60d7..1c8d957890 100644 --- a/src/creds/creds.c +++ b/src/creds/creds.c @@ -382,9 +382,7 @@ static int verb_cat(int argc, char **argv, void *userdata) { int encrypted; if (!credential_name_valid(*cn)) { - log_error("Credential name '%s' is not valid.", *cn); - if (ret >= 0) - ret = -EINVAL; + RET_GATHER(ret, log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Credential name '%s' is not valid.", *cn)); continue; } @@ -409,16 +407,11 @@ static int verb_cat(int argc, char **argv, void *userdata) { if (r >= 0) /* Found */ break; - log_error_errno(r, "Failed to read credential '%s': %m", *cn); - if (ret >= 0) - ret = r; + RET_GATHER(ret, log_error_errno(r, "Failed to read credential '%s': %m", *cn)); } if (encrypted >= 2) { /* Found nowhere */ - log_error_errno(SYNTHETIC_ERRNO(ENOENT), "Credential '%s' not set.", *cn); - if (ret >= 0) - ret = -ENOENT; - + RET_GATHER(ret, log_error_errno(SYNTHETIC_ERRNO(ENOENT), "Credential '%s' not set.", *cn)); continue; } |