diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2023-12-30 11:33:38 -0500 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-12-31 11:16:56 +0100 |
commit | 69905110f5d840dbb0e0986f7eade8cfc9d3dafc (patch) | |
tree | b451933bf3ed433f7801dd229144771cf1ba2fa9 /utils | |
parent | 8d8520bb9957c6a45cdaf9566134e474e84d4fde (diff) | |
download | hurd-69905110f5d840dbb0e0986f7eade8cfc9d3dafc.tar.gz hurd-69905110f5d840dbb0e0986f7eade8cfc9d3dafc.tar.bz2 hurd-69905110f5d840dbb0e0986f7eade8cfc9d3dafc.zip |
x86_64: utmp uses int32_t to store time so use a temporary variable
Message-ID: <ZZBGYmkYNwpoamBm@jupiter.tail36e24.ts.net>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/login.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/login.c b/utils/login.c index 3134c4aa..334941cf 100644 --- a/utils/login.c +++ b/utils/login.c @@ -157,12 +157,17 @@ static void add_utmp_entry (char *args, unsigned args_len, int inherit_host) { struct utmp utmp; + struct timeval current_time; char const *host = 0; long addr = 0; memset (&utmp, 0, sizeof(utmp)); - gettimeofday (&utmp.ut_tv, 0); + gettimeofday (¤t_time, NULL); + /* For x86_64, sizeof(utmp.ut_tv) != sizeof(struct timeval) */ + utmp.ut_tv.tv_sec = current_time.tv_sec; + utmp.ut_tv.tv_usec = current_time.tv_usec; + strncpy (utmp.ut_name, envz_get (args, args_len, "USER") ?: "", sizeof (utmp.ut_name)); |