diff options
author | Alexey Gladkov <gladkov.alexey@gmail.com> | 2023-04-28 12:09:13 +0200 |
---|---|---|
committer | Alexey Gladkov <gladkov.alexey@gmail.com> | 2023-04-28 13:31:43 +0200 |
commit | eb607a50f341ba50ef712b012afa415ba1b01851 (patch) | |
tree | 1a89c5e267d8f568b883f62287ca2cd26f65891c | |
parent | 1002d3b56b72b98597e37a0132b719eb55775a24 (diff) | |
download | kbd-eb607a50f341ba50ef712b012afa415ba1b01851.tar.gz |
Do not use goto from optional code
If KD_FONT_OP_GET_TALL is not defined, a compilation warning about an
unused label occurs (-Wunused-label).
Fixes: 287a3bae ("font: Leverage KD_FONT_OP_GET/SET_TALL font operations")
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
-rw-r--r-- | src/libkfont/kdfontop.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/libkfont/kdfontop.c b/src/libkfont/kdfontop.c index 209f6fce..b3873ac2 100644 --- a/src/libkfont/kdfontop.c +++ b/src/libkfont/kdfontop.c @@ -67,24 +67,27 @@ get_font_kdfontop(struct kfont_context *ctx, int consolefd, cfo.charcount = *count; cfo.data = buf; -retry: - errno = 0; + while (1) { + errno = 0; - if (ioctl(consolefd, KDFONTOP, &cfo)) { + if (ioctl(consolefd, KDFONTOP, &cfo)) { #ifdef KD_FONT_OP_GET_TALL - if (errno == ENOSYS && cfo.op == KD_FONT_OP_GET_TALL) { - /* Kernel before 6.2. */ - cfo.op = KD_FONT_OP_GET; - goto retry; - } + if (errno == ENOSYS && cfo.op == KD_FONT_OP_GET_TALL) { + /* Kernel before 6.2. */ + cfo.op = KD_FONT_OP_GET; + continue; + } #endif - if (errno != ENOSYS && errno != EINVAL) { - KFONT_ERR(ctx, "ioctl(KDFONTOP): %m"); - return -1; + if (errno != ENOSYS && errno != EINVAL) { + KFONT_ERR(ctx, "ioctl(KDFONTOP): %m"); + return -1; + } + return 1; } - return 1; + break; } + *count = cfo.charcount; if (height) *height = cfo.height; |