summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-09 13:12:55 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-09 13:13:07 +0200
commitab51b943d42eb6a5e4c6e26cd3c641d4e604bd1c (patch)
tree607c77b1d05da87e33b5e1e185fb868d63b1a3dd /src
parent71044f609b829d802e0eb81270e13b4f55d76476 (diff)
vconsole: some modernizations, indentation fixes
Diffstat (limited to 'src')
-rw-r--r--src/vconsole/vconsole-setup.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 5c95e3f47b..243e51dfc9 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -185,11 +185,13 @@ static void font_copy_to_all_vcs(int fd) {
/* get active, and 16 bit mask of used VT numbers */
r = ioctl(fd, VT_GETSTATE, &vcs);
- if (r < 0)
+ if (r < 0) {
+ log_debug_errno(errno, "VT_GETSTATE failed, ignoring: %m");
return;
+ }
for (i = 1; i <= 15; i++) {
- char vcname[16];
+ char vcname[strlen("/dev/vcs") + DECIMAL_STR_MAX(int)];
_cleanup_close_ int vcfd = -1;
struct console_font_op cfo = {};
@@ -213,11 +215,11 @@ static void font_copy_to_all_vcs(int fd) {
/* copy map of 8bit chars */
if (ioctl(fd, GIO_SCRNMAP, map8) >= 0)
- (void) ioctl(vcfd, PIO_SCRNMAP, map8);
+ (void) ioctl(vcfd, PIO_SCRNMAP, map8);
/* copy map of 8bit chars -> 16bit Unicode values */
if (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0)
- (void) ioctl(vcfd, PIO_UNISCRNMAP, map16);
+ (void) ioctl(vcfd, PIO_UNISCRNMAP, map16);
/* copy unicode translation table */
/* unimapd is a ushort count and a pointer to an
@@ -239,8 +241,7 @@ int main(int argc, char **argv) {
*vc_keymap = NULL, *vc_keymap_toggle = NULL,
*vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL;
_cleanup_close_ int fd = -1;
- bool utf8;
- bool font_copy = false, font_ok, keyboard_ok;
+ bool utf8, font_copy = false, font_ok, keyboard_ok;
int r = EXIT_FAILURE;
log_set_target(LOG_TARGET_AUTO);
@@ -295,16 +296,16 @@ int main(int argc, char **argv) {
}
if (utf8)
- enable_utf8(fd);
+ (void) enable_utf8(fd);
else
- disable_utf8(fd);
+ (void) disable_utf8(fd);
font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap) > 0;
keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle, utf8) > 0;
/* Only copy the font when we executed setfont successfully */
if (font_copy && font_ok)
- font_copy_to_all_vcs(fd);
+ (void) font_copy_to_all_vcs(fd);
return font_ok && keyboard_ok ? EXIT_SUCCESS : EXIT_FAILURE;
}