diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-08-08 08:51:22 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-08-08 08:51:22 +0000 |
commit | 924a7ff7faa7300916e6bb1bc330a2ab4abd69f4 (patch) | |
tree | 99ca82e953da7e4a0bedbb8f5ef70865eb6f428a /usr.sbin/relayd/relay_udp.c | |
parent | bbc0041d77729a4313493f1f7efd97049630d0e0 (diff) |
Check gettimeofday() against -1; Add a missing error check in one place.
OK reyk@
Diffstat (limited to 'usr.sbin/relayd/relay_udp.c')
-rw-r--r-- | usr.sbin/relayd/relay_udp.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/relayd/relay_udp.c b/usr.sbin/relayd/relay_udp.c index d6eeca6fbd5..fc1ee0538d8 100644 --- a/usr.sbin/relayd/relay_udp.c +++ b/usr.sbin/relayd/relay_udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_udp.c,v 1.16 2008/07/23 10:05:18 reyk Exp $ */ +/* $OpenBSD: relay_udp.c,v 1.17 2008/08/08 08:51:21 thib Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -257,7 +257,13 @@ relay_udp_server(int fd, short sig, void *arg) con->se_in.dir = RELAY_DIR_REQUEST; con->se_out.dir = RELAY_DIR_RESPONSE; con->se_retry = rlay->rl_conf.dstretry; - gettimeofday(&con->se_tv_start, NULL); + + if (gettimeofday(&con->se_tv_start, NULL) == -1) { + free(con); + free(priv); + return; + } + bcopy(&con->se_tv_start, &con->se_tv_last, sizeof(con->se_tv_last)); bcopy(&ss, &con->se_in.ss, sizeof(con->se_in.ss)); con->se_out.port = rlay->rl_conf.dstport; @@ -466,7 +472,7 @@ relay_dns_request(struct session *con) if (debug) relay_dns_log(con, buf, len); - if (gettimeofday(&con->se_tv_start, NULL)) + if (gettimeofday(&con->se_tv_start, NULL) == -1) return (-1); if (rlay->rl_dsttable != NULL) { |