diff --git a/buffyboard/command_line.c b/buffyboard/command_line.c index 144dc09..fb8efcc 100644 --- a/buffyboard/command_line.c +++ b/buffyboard/command_line.c @@ -52,7 +52,7 @@ static void init_opts(bb_cli_opts *opts) { int fd_rotate = open("/sys/class/graphics/fbcon/rotate", O_RDONLY); if (fd_rotate < 0) { bbx_log(BBX_LOG_LEVEL_WARNING, "Can not open /sys/class/graphics/fbcon/rotate"); - goto end; + return; } char buffer[3]; @@ -75,6 +75,9 @@ static void init_opts(bb_cli_opts *opts) { case '3': opts->rotation = LV_DISPLAY_ROTATION_90; break; + default: + bbx_log(BBX_LOG_LEVEL_WARNING, "Unexpected value of /sys/class/graphics/fbcon/rotate"); + break; } end: diff --git a/buffyboard/main.c b/buffyboard/main.c index 3e692af..824c402 100644 --- a/buffyboard/main.c +++ b/buffyboard/main.c @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) { lseek(fd_tty, 0, SEEK_SET); char buffer[8]; - ssize_t size = read(fd_tty, buffer, sizeof(buffer)); + ssize_t size = read(fd_tty, buffer, sizeof(buffer) - 1); if (size <= 0) { bbx_log(BBX_LOG_LEVEL_WARNING, "Can't read /sys/class/tty/tty0/active"); continue;