Skip to content

Commit

Permalink
Fix gettime usage
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonnessjoen committed May 1, 2024
1 parent 194aa57 commit 21322d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mactelnetd.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ static void display_nologin() {

static void uwtmp_login(struct mt_connection *conn) {
struct utmpx utent;
struct timeval tv;
pid_t pid;

pid = getpid();
Expand All @@ -355,7 +356,9 @@ static void uwtmp_login(struct mt_connection *conn) {
strncpy(utent.ut_line, line, sizeof(utent.ut_line));
strncpy(utent.ut_id, utent.ut_line + 3, sizeof(utent.ut_id));
strncpy(utent.ut_host, ether_ntoa((const struct ether_addr *)conn->srcmac), sizeof(utent.ut_host));
gettimeofday(&utent.ut_tv, NULL);
gettimeofday(&tv, NULL);
utent.ut_tv.tv_sec = tv.tv_sec;
utent.ut_tv.tv_usec = tv.tv_usec;

/* Update utmp and/or wtmp */
setutxent();
Expand Down

0 comments on commit 21322d0

Please sign in to comment.