From 3d970d8fa2cd0f98c5981105afbdbfe9e32ec31a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 4 Feb 2007 18:59:13 +0000 Subject: Two libevent fixes from the SVN repo: allow gotsig to terminate active event loop and evbuffer_find fix. OK brad@ pyr@ --- lib/libevent/buffer.c | 9 +++++---- lib/libevent/event.c | 4 +++- lib/libevent/event.h | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/libevent/buffer.c b/lib/libevent/buffer.c index 4a1ac9f7a29..2c706bb4ff0 100644 --- a/lib/libevent/buffer.c +++ b/lib/libevent/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.12 2006/12/21 02:28:47 krw Exp $ */ +/* $OpenBSD: buffer.c,v 1.13 2007/02/04 18:59:12 millert Exp $ */ /* * Copyright (c) 2002, 2003 Niels Provos @@ -434,12 +434,13 @@ evbuffer_find(struct evbuffer *buffer, const u_char *what, size_t len) u_char *search = buffer->buffer; u_char *p; - while ((p = memchr(search, *what, remain)) != NULL && remain >= len) { + while ((p = memchr(search, *what, remain)) != NULL) { + remain = buffer->off - (size_t)(search - buffer->buffer); + if (remain < len) + break; if (memcmp(p, what, len) == 0) return (p); - search = p + 1; - remain = buffer->off - (size_t)(search - buffer->buffer); } return (NULL); diff --git a/lib/libevent/event.c b/lib/libevent/event.c index 13049b286c9..7012da54447 100644 --- a/lib/libevent/event.c +++ b/lib/libevent/event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: event.c,v 1.14 2006/11/05 03:39:40 brad Exp $ */ +/* $OpenBSD: event.c,v 1.15 2007/02/04 18:59:12 millert Exp $ */ /* * Copyright (c) 2000-2004 Niels Provos @@ -303,6 +303,8 @@ event_process_active(struct event_base *base) ncalls--; ev->ev_ncalls = ncalls; (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg); + if (event_gotsig) + return; } } } diff --git a/lib/libevent/event.h b/lib/libevent/event.h index 1c8d29a2203..5791b16c9bf 100644 --- a/lib/libevent/event.h +++ b/lib/libevent/event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: event.h,v 1.15 2006/03/30 06:32:36 brad Exp $ */ +/* $OpenBSD: event.h,v 1.16 2007/02/04 18:59:12 millert Exp $ */ /* * Copyright (c) 2000-2004 Niels Provos @@ -42,7 +42,7 @@ extern "C" { typedef unsigned char u_char; #endif -#define LIBEVENT_VERSION "1.1a" +#define LIBEVENT_VERSION "1.1b" #define EVLIST_TIMEOUT 0x01 #define EVLIST_INSERTED 0x02 -- cgit v1.2.3