Hi all,
I was looking through the set of patches applied through FreeBSD's ports
tree and I guess the following two changes can easily be applied
upstream.
According to POSIX, ut_tv.tv_sec is the only valid way to access the
timestamp in seconds from an utmpx structure. ut_xtime is a convenience
macro provided by some implementations, but certainly not part of the
standard.
Also, some utmp implementations (e.g. FreeBSD 8 and below) use an int to
store the timestamp instead of a time_t. Just use the return value of
time() to avoid the problem altogether.
--- os.h
+++ os.h
@@ -270,7 +274,7 @@
# define pututline pututxline
# define setutent setutxent
# define endutent endutxent
-# define ut_time ut_xtime
+# define ut_time ut_tv.tv_sec
# else /* SVR4 */
# include <utmp.h>
# endif /* SVR4 */
--- utmp.c
+++ utmp.c
@@ -728,7 +728,7 @@
{
strncpy(u->ut_line, line, sizeof(u->ut_line));
strncpy(u->ut_name, user, sizeof(u->ut_name));
- (void)time((time_t *)&u->ut_time);
+ u->ut_time = time(NULL);
}
static slot_t
Ciao,
--
Ed Schouten <[email protected]>
WWW: http://80386.nl/