[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH hurd 05/11] x86_64: utmp uses int32_t to store time so use a
From: |
Samuel Thibault |
Subject: |
Re: [PATCH hurd 05/11] x86_64: utmp uses int32_t to store time so use a temporary variable |
Date: |
Fri, 29 Dec 2023 22:36:06 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Flavio Cruz, le ven. 29 déc. 2023 16:20:59 -0500, a ecrit:
> ---
> utils/login.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/utils/login.c b/utils/login.c
> index 3134c4a..3ed5121 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, 0);
> + /* For x86_64, sizeof(utmp.ut_tv) != sizeof(struct timeval) */
> + utmp.ut_tv.tv_sec = (int32_t) current_time.tv_sec;
> + utmp.ut_tv.tv_usec = (int32_t) current_time.tv_usec;
I don't think we want to explicitly cast? Glibc's utmp has a #if/#else
that possibly makes it use timeval.
> +
> strncpy (utmp.ut_name, envz_get (args, args_len, "USER") ?: "",
> sizeof (utmp.ut_name));
- [PATCH hurd 01/11] Initialize a few error variables to avoid GCC warnings, Flavio Cruz, 2023/12/29
- [PATCH hurd 02/11] Cast bootinfo to struct diskfs_control * to silence warning, Flavio Cruz, 2023/12/29
- [PATCH hurd 04/11] Fix printf format specifiers, Flavio Cruz, 2023/12/29
- [PATCH hurd 07/11] Fix a few pointer related warnings., Flavio Cruz, 2023/12/29
- [PATCH hurd 05/11] x86_64: utmp uses int32_t to store time so use a temporary variable, Flavio Cruz, 2023/12/29
- Re: [PATCH hurd 05/11] x86_64: utmp uses int32_t to store time so use a temporary variable,
Samuel Thibault <=
- [PATCH hurd 03/11] Use mach_msg_type_number_t whenever required to avoid warnings, Flavio Cruz, 2023/12/29
- [PATCH hurd 06/11] x86_64: use 21 bytes in libps since %z might require more characters., Flavio Cruz, 2023/12/29
- [PATCH hurd 09/11] Fix overflow issues in tmpfs and vmallocate, Flavio Cruz, 2023/12/29
- [PATCH hurd 10/11] libftpconn: add out >= 2 condition to make GCC happy, Flavio Cruz, 2023/12/29
- [PATCH hurd 11/11] pfinet: fix type alias, Flavio Cruz, 2023/12/29