screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] Small local FreeBSD patches which can be merged upstream


From: Ed Schouten
Subject: [screen-devel] Small local FreeBSD patches which can be merged upstream
Date: Fri, 13 Aug 2010 10:16:12 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

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 <address@hidden>
 WWW: http://80386.nl/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]