From: Lennart Poettering Date: Tue, 8 Aug 2023 12:20:17 +0000 (+0200) Subject: vconsole-setup: simplify error handling X-Git-Tag: v255-rc1~782^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28720%2Fhead;p=thirdparty%2Fsystemd.git vconsole-setup: simplify error handling no need to negate an error which we don't need negated. also, add debug log about errors we ignore. --- diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c index 5f595bf1241..73fc0f22da7 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c @@ -512,8 +512,8 @@ static int find_source_vc(char **ret_path, unsigned *ret_idx) { r = verify_vc_allocation(i); if (r < 0) { - if (!err) - err = -r; + log_debug_errno(r, "VC %u existance check failed, skipping: %m", i); + RET_GATHER(err, r); continue; } @@ -522,14 +522,14 @@ static int find_source_vc(char **ret_path, unsigned *ret_idx) { fd = open_terminal(path, O_RDWR|O_CLOEXEC|O_NOCTTY); if (fd < 0) { - if (!err) - err = -fd; + log_debug_errno(fd, "Failed to open terminal %s, ignoring: %m", path); + RET_GATHER(err, r); continue; } r = verify_vc_kbmode(fd); if (r < 0) { - if (!err) - err = -r; + log_debug_errno(r, "Failed to check VC %s keyboard mode: %m", path); + RET_GATHER(err, r); continue; }