Skip to content

Commit 35a2124

Browse files
committed
utmpset.c: mixes "int32_t *" and "time_t *"
Don't pass int32_t to time(), thx Lorenzo Beretta, https://bugs.debian.org/754849
1 parent 4d2a8e6 commit 35a2124

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/utmpset.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }
2424
int utmp_logout(const char *line) {
2525
int fd;
2626
uw_tmp ut;
27+
time_t t;
2728
int ok =-1;
2829

2930
if ((fd =open(UW_TMP_UFILE, O_RDWR, 0)) < 0)
@@ -35,7 +36,8 @@ int utmp_logout(const char *line) {
3536
if (!ut.ut_name[0] || (str_diff(ut.ut_line, line) != 0)) continue;
3637
memset(ut.ut_name, 0, sizeof ut.ut_name);
3738
memset(ut.ut_host, 0, sizeof ut.ut_host);
38-
if (time(&ut.ut_time) == -1) break;
39+
if (time(&t) == -1) break;
40+
ut.ut_time = t;
3941
#ifdef DEAD_PROCESS
4042
ut.ut_type =DEAD_PROCESS;
4143
#endif
@@ -52,6 +54,7 @@ int wtmp_logout(const char *line) {
5254
int len;
5355
struct stat st;
5456
uw_tmp ut;
57+
time_t t;
5558

5659
if ((fd = open_append(UW_TMP_WFILE)) == -1)
5760
strerr_die4sys(111, FATAL, "unable to open ", UW_TMP_WFILE, ": ");
@@ -65,10 +68,11 @@ int wtmp_logout(const char *line) {
6568
memset(&ut, 0, sizeof(uw_tmp));
6669
if ((len =str_len(line)) > sizeof ut.ut_line) len =sizeof ut.ut_line -2;
6770
byte_copy(ut.ut_line, len, line);
68-
if (time(&ut.ut_time) == -1) {
71+
if (time(&t) == -1) {
6972
close(fd);
7073
return(-1);
7174
}
75+
ut.ut_time = t;
7276
#ifdef DEAD_PROCESS
7377
ut.ut_type =DEAD_PROCESS;
7478
#endif

0 commit comments

Comments
 (0)