]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bsod: remove one redundant variable
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Feb 2024 08:59:35 +0000 (09:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 21 Feb 2024 14:11:27 +0000 (15:11 +0100)
src/journal/bsod.c

index c4022cdf6ea2a3d04fdbb8f7e47d2d03643dab9e..3c64a8389095a4d231cb3a6980e51bb5b823b03e 100644 (file)
@@ -140,7 +140,7 @@ static int find_next_free_vt(int fd, int *ret_free_vt, int *ret_original_vt) {
 }
 
 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;
@@ -191,7 +191,7 @@ static int display_emergency_message_fullscreen(const char *message) {
 
         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;
         }
 
@@ -203,13 +203,13 @@ static int display_emergency_message_fullscreen(const char *message) {
 
         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;
         }
 
@@ -223,19 +223,21 @@ static int display_emergency_message_fullscreen(const char *message) {
 
         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[]) {