}
static int display_emergency_message_fullscreen(const char *message) {
- int r, ret = 0, free_vt = 0, original_vt = 0;
+ int r, free_vt = 0, original_vt = 0;
unsigned qr_code_start_row = 1, qr_code_start_column = 1;
char ttybuf[STRLEN("/dev/tty") + DECIMAL_STR_MAX(int) + 1];
_cleanup_close_ int fd = -EBADF;
r = loop_write(fd, "The current boot has failed!", SIZE_MAX);
if (r < 0) {
- ret = log_error_errno(r, "Failed to write to terminal: %m");
+ log_error_errno(r, "Failed to write to terminal: %m");
goto cleanup;
}
r = loop_write(fd, message, SIZE_MAX);
if (r < 0) {
- ret = log_error_errno(r, "Failed to write emergency message to terminal: %m");
+ log_error_errno(r, "Failed to write emergency message to terminal: %m");
goto cleanup;
}
r = fdopen_independent(fd, "r+", &stream);
if (r < 0) {
- ret = log_error_errno(errno, "Failed to open output file: %m");
+ r = log_error_errno(errno, "Failed to open output file: %m");
goto cleanup;
}
r = loop_write(fd, ANSI_BACKGROUND_BLUE "Press any key to exit...", SIZE_MAX);
if (r < 0) {
- ret = log_error_errno(r, "Failed to write to terminal: %m");
+ log_error_errno(r, "Failed to write to terminal: %m");
goto cleanup;
}
r = read_one_char(stream, &read_character_buffer, USEC_INFINITY, NULL);
if (r < 0 && r != -EINTR)
- ret = log_error_errno(r, "Failed to read character: %m");
+ log_error_errno(r, "Failed to read character: %m");
+
+ r = 0;
cleanup:
if (original_vt > 0 && ioctl(fd, VT_ACTIVATE, original_vt) < 0)
return log_error_errno(errno, "Failed to switch back to original VT /dev/tty%i: %m", original_vt);
- return ret;
+ return r;
}
static int parse_argv(int argc, char * argv[]) {