summaryrefslogtreecommitdiffstats
path: root/src/creds/creds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/creds/creds.c')
-rw-r--r--src/creds/creds.c13
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;
}