-/* $OpenBSD: check_icmp.c,v 1.24 2008/07/19 10:52:32 reyk Exp $ */
+/* $OpenBSD: check_icmp.c,v 1.25 2008/08/08 08:51:21 thib Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
if (start != NULL)
bcopy(start, &cie->tv_start, sizeof(cie->tv_start));
bcopy(&cie->env->sc_timeout, &tv, sizeof(tv));
- if (gettimeofday(&cie->tv_start, NULL))
+ if (gettimeofday(&cie->tv_start, NULL) == -1)
fatal("check_icmp_add: gettimeofday");
event_del(&cie->ev);
event_set(&cie->ev, cie->s, EV_TIMEOUT|flags, fn, cie);
-/* $OpenBSD: hce.c,v 1.43 2008/07/19 11:38:54 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.44 2008/08/08 08:51:21 thib Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
}
}
- if (gettimeofday(&tv, NULL))
+ if (gettimeofday(&tv, NULL) == -1)
fatal("hce_launch_checks: gettimeofday");
TAILQ_FOREACH(table, env->sc_tables, entry) {
else
logopt = RELAYD_OPT_LOGNOTIFY;
- if (gettimeofday(&tv_now, NULL))
+ if (gettimeofday(&tv_now, NULL) == -1)
fatal("hce_notify_done: gettimeofday");
timersub(&tv_now, &host->cte.tv_start, &tv_dur);
if (timercmp(&host->cte.tv_start, &tv_dur, >))
-/* $OpenBSD: pfe.c,v 1.50 2008/07/19 11:38:54 reyk Exp $ */
+/* $OpenBSD: pfe.c,v 1.51 2008/08/08 08:51:21 thib Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
u_long cnt;
timerclear(&tv);
- if (gettimeofday(&tv_now, NULL))
+ if (gettimeofday(&tv_now, NULL) == -1)
fatal("pfe_statistics: gettimeofday");
TAILQ_FOREACH(rdr, env->sc_rdrs, entry) {
-/* $OpenBSD: relay.c,v 1.95 2008/07/22 23:17:37 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.96 2008/08/08 08:51:21 thib Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
*/
timerclear(&tv);
- if (gettimeofday(&tv_now, NULL))
+ if (gettimeofday(&tv_now, NULL) == -1)
fatal("relay_init: gettimeofday");
TAILQ_FOREACH(rlay, env->sc_relays, rl_entry) {
{
struct ctl_relay_event *cre = (struct ctl_relay_event *)arg;
struct session *con = (struct session *)cre->con;
- if (gettimeofday(&con->se_tv_last, NULL))
+ if (gettimeofday(&con->se_tv_last, NULL) == -1)
con->se_done = 1;
if (con->se_done)
relay_close(con, "last write (done)");
struct session *con = (struct session *)cre->con;
struct evbuffer *src = EVBUFFER_INPUT(bev);
- if (gettimeofday(&con->se_tv_last, NULL))
+ if (gettimeofday(&con->se_tv_last, NULL) == -1)
goto done;
if (!EVBUFFER_LENGTH(src))
return;
struct evbuffer *src = EVBUFFER_INPUT(bev);
size_t size;
- if (gettimeofday(&con->se_tv_last, NULL))
+ if (gettimeofday(&con->se_tv_last, NULL) == -1)
goto done;
size = EVBUFFER_LENGTH(src);
DPRINTF("relay_read_httpcontent: size %d, to read %d",
long lval;
size_t size;
- if (gettimeofday(&con->se_tv_last, NULL))
+ if (gettimeofday(&con->se_tv_last, NULL) == -1)
goto done;
size = EVBUFFER_LENGTH(src);
DPRINTF("relay_read_httpchunks: size %d, to read %d",
const char *errstr;
size_t size;
- if (gettimeofday(&con->se_tv_last, NULL))
+ if (gettimeofday(&con->se_tv_last, NULL) == -1)
goto done;
size = EVBUFFER_LENGTH(src);
DPRINTF("relay_read_http: size %d, to read %d", size, cre->toread);
con->se_out.dir = RELAY_DIR_RESPONSE;
con->se_retry = rlay->rl_conf.dstretry;
con->se_bnds = -1;
- if (gettimeofday(&con->se_tv_start, NULL))
+ if (gettimeofday(&con->se_tv_start, NULL) == -1)
goto err;
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));
struct relay *rlay = (struct relay *)con->se_relay;
int bnds = -1, ret;
- if (gettimeofday(&con->se_tv_start, NULL))
+ if (gettimeofday(&con->se_tv_start, NULL) == -1)
return (-1);
if (rlay->rl_dsttable != NULL) {
-/* $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>
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;
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) {
-/* $OpenBSD: relayd.c,v 1.79 2008/07/22 23:17:37 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.80 2008/08/08 08:51:21 thib Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
{
struct timeval tv_next, tv_now, tv;
- if (gettimeofday(&tv_now, NULL))
+ if (gettimeofday(&tv_now, NULL) == -1)
fatal("event_again: gettimeofday");
bcopy(end, &tv_next, sizeof(tv_next));