From 3faf3dec42493da2479dfc713cab7a4442027f05 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Sat, 18 Oct 2025 08:41:36 +0200 Subject: [PATCH] Fix login issue Signed-off-by: AnErrupTion --- readme.md | 2 +- src/auth.zig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 86c1ffb..a02bcda 100644 --- a/readme.md +++ b/readme.md @@ -183,7 +183,7 @@ To disable TTY 2, go to `/etc/inittab` and comment out the line containing `tty2 # sysrc ly_enable="YES" ``` -To disable TTY 2, go to `/etc/ttys` and comment out the line starting with `ttyv2`. +To disable TTY 2, go to `/etc/ttys` and comment out the line starting with `ttyv1` (TTYs start at 0 in FreeBSD). ### Updating diff --git a/src/auth.zig b/src/auth.zig index d0867fa..6e6a2a9 100644 --- a/src/auth.zig +++ b/src/auth.zig @@ -511,12 +511,12 @@ fn addUtmpEntry(entry: *Utmp, username: []const u8, pid: c_int) !void { // Get the TTY name (i.e. without the /dev/ prefix) var ttyname_buf: [@sizeOf(@TypeOf(entry.ut_line))]u8 = undefined; - const ttyname = try std.fmt.bufPrintZ(&ttyname_buf, "{s}", .{tty_path["/dev/".len..]}); + _ = try std.fmt.bufPrintZ(&ttyname_buf, "{s}", .{tty_path["/dev/".len..]}); entry.ut_line = ttyname_buf; // Get the TTY ID (i.e. without the tty prefix) and truncate it to the size // of ut_id if necessary - entry.ut_id = ttyname["tty".len..(@sizeOf(@TypeOf(entry.ut_id)) + "tty".len)].*; + entry.ut_id = ttyname_buf["tty".len..(@sizeOf(@TypeOf(entry.ut_id)) + "tty".len)].*; var username_buf: [@sizeOf(@TypeOf(entry.ut_user))]u8 = undefined; _ = try std.fmt.bufPrintZ(&username_buf, "{s}", .{username});