gentoo-ebuilds/app-i18n/jfbterm/files/jfbterm-0.4.7-gettimeoftheday.patch
NHOrus 77728d89f2
app-i18n/jfbterm: update EAPI 7 -> 8, fix home URI, port to C23
Changes call to time() to call to gettimeofday() according to utmp man page
Removes font installation from makefile and delegates to portage machinery
so font cache gets updated

Bug: https://bugs.gentoo.org/835793
Closes: https://bugs.gentoo.org/919295
Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40547
Signed-off-by: Sam James <sam@gentoo.org>
2025-02-12 18:15:42 +00:00

43 lines
1 KiB
Diff

Man 5 utmp has instructions how to replace time with gettimeofday in utmp.
Use them.
https://bugs.gentoo.org/919295
--- a/term.c
+++ b/term.c
@@ -248,6 +248,7 @@
struct utmp utmp;
struct passwd *pw;
char *tn;
+ struct timeval tv;
pw = getpwuid(util_getuid());
tn = rindex(p->name, '/') + 1;
@@ -262,7 +263,9 @@
tn = p->name + 5;
strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line));
strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user));
- time(&(utmp.ut_time));
+ gettimeofday(&tv, NULL);
+ utmp.ut_tv.tv_sec = tv.tv_sec;
+ utmp.ut_tv.tv_usec = tv.tv_usec;
pututline(&utmp);
endutent();
}
@@ -271,6 +274,7 @@
{
struct utmp utmp, *utp;
char *tn;
+ struct timeval tv;
tn = rindex(p->name, '/') + 4;
memset((char *)&utmp, 0, sizeof(utmp));
@@ -281,7 +285,9 @@
utp->ut_type = DEAD_PROCESS;
memset(utp->ut_user, 0, sizeof(utmp.ut_user));
utp->ut_type = DEAD_PROCESS;
- time(&(utp->ut_time));
+ gettimeofday(&tv, NULL);
+ utp->ut_tv.tv_sec = tv.tv_sec;
+ utp->ut_tv.tv_usec = tv.tv_usec;
pututline(utp);
endutent();
}