diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2012-09-01 14:45:15 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2012-09-01 14:45:15 +0000 |
| commit | 902d9eafbf66c52f8513bc38f4d0c8063c0b8a03 (patch) | |
| tree | 496a0b9a3b14c27d50e1ae3b28265ecf5c2023f2 /libexec/rbootd/rbootd.c | |
| parent | aeb99b567a54f0ce25c0cf33eb758f15add4580c (diff) | |
Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:
int gettimeofday(struct timeval *restrict tp, void *restrict tzp);
Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.
While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
Notes
svn path=/head/; revision=239991
Diffstat (limited to 'libexec/rbootd/rbootd.c')
| -rw-r--r-- | libexec/rbootd/rbootd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libexec/rbootd/rbootd.c b/libexec/rbootd/rbootd.c index e56a3e77a428..1d35bd1e2eeb 100644 --- a/libexec/rbootd/rbootd.c +++ b/libexec/rbootd/rbootd.c @@ -310,16 +310,15 @@ void DoTimeout(void) { RMPCONN *rtmp; - struct timeval now; - - (void) gettimeofday(&now, (struct timezone *)0); + time_t now; /* * For each active connection, if RMP_TIMEOUT seconds have passed * since the last packet was sent, delete the connection. */ + now = time(NULL); for (rtmp = RmpConns; rtmp != NULL; rtmp = rtmp->next) - if ((rtmp->tstamp.tv_sec + RMP_TIMEOUT) < now.tv_sec) { + if ((rtmp->tstamp.tv_sec + RMP_TIMEOUT) < now) { syslog(LOG_WARNING, "%s: connection timed out (%u)", EnetStr(rtmp), rtmp->rmp.r_type); RemoveConn(rtmp); |
