]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bsod: make message for qrcode more useful
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Oct 2024 12:51:25 +0000 (13:51 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 30 Oct 2024 14:03:17 +0000 (15:03 +0100)
People know what a qrcode is. We don't need to tell them to scan it.
Instead, we should say what the code contains.

While at it, rename "stream" to "f" in line with the usual style.

src/journal/bsod.c
test/units/TEST-04-JOURNAL.bsod.sh

index c76b04718ee4fffe5a4c5de0cf06d77692edf6e9..2f06808cd4c02d512d08eba93365eb5aed34e913 100644 (file)
@@ -143,7 +143,7 @@ static int display_emergency_message_fullscreen(const char *message) {
         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;
-        _cleanup_fclose_ FILE *stream = NULL;
+        _cleanup_fclose_ FILE *f = NULL;
         char read_character_buffer = '\0';
         struct winsize w = {
                 .ws_col = 80,
@@ -206,13 +206,13 @@ static int display_emergency_message_fullscreen(const char *message) {
                 goto cleanup;
         }
 
-        r = fdopen_independent(fd, "r+", &stream);
+        r = fdopen_independent(fd, "r+", &f);
         if (r < 0) {
                 r = log_error_errno(errno, "Failed to open output file: %m");
                 goto cleanup;
         }
 
-        r = print_qrcode_full(stream, "Scan the QR code",
+        r = print_qrcode_full(f, "Scan the error message",
                               message, qr_code_start_row, qr_code_start_column, w.ws_col, w.ws_row,
                               /* check_tty= */ false);
         if (r < 0)
@@ -228,7 +228,7 @@ static int display_emergency_message_fullscreen(const char *message) {
                 goto cleanup;
         }
 
-        r = read_one_char(stream, &read_character_buffer, USEC_INFINITY, NULL);
+        r = read_one_char(f, &read_character_buffer, USEC_INFINITY, NULL);
         if (r < 0 && r != -EINTR)
                 log_error_errno(r, "Failed to read character: %m");
 
index 802d474f163f190f28f9b3ef2875c3b659a6a81b..d4a4ff26da9bddb8dfced0c0994596e5e3623de1 100755 (executable)
@@ -89,7 +89,7 @@ journalctl --sync
 SYSTEMD_COLORS=256 /usr/lib/systemd/systemd-bsod &
 PID=$!
 vcs_dump_and_check "Root emergency message"
-grep -aq "Scan the QR code" /tmp/console.dump
+grep -aq "Scan the error message" /tmp/console.dump
 # TODO: check if systemd-bsod exits on a key press (didn't figure this one out yet)
 kill $PID
 timeout 10 bash -c "while kill -0 $PID; do sleep .5; done"