Skip to content

Commit

Permalink
[cmds] Fix off-by-one bug in getty @t command
Browse files Browse the repository at this point in the history
The `@T` command, when placed in /etc/issue, displays the current system time.
The shuffling of the date string in `when()` had an off-by-one error, which
meant that instead of showing `17:42:00`, it showed `77:42:00`
  • Loading branch information
vkoskiv committed Sep 16, 2024
1 parent dc10f66 commit 3ca6377
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion elkscmd/sys_utils/getty.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void when(void) {

Result[2] = Result[6] = '-';

for (n=20; n>12; n--)
for (n=20; n>11; n--)
Result[n] = Result[n-1];

Result[11] = Result[20] = '\0';
Expand Down

0 comments on commit 3ca6377

Please sign in to comment.