openbsd-ports/sysutils/gamin/patches/patch-libgamin_gam_api_c
ajacoutot b4900052b8 Fix memleaks by including string.h where needed.
While here, switch to new REVISION/DEPENDS.
2010-07-13 14:10:35 +00:00

43 lines
1.1 KiB
Plaintext

$OpenBSD: patch-libgamin_gam_api_c,v 1.4 2010/07/13 14:10:35 ajacoutot Exp $
--- libgamin/gam_api.c.orig Mon Aug 27 12:21:03 2007
+++ libgamin/gam_api.c Tue Jul 13 15:52:47 2010
@@ -4,6 +4,7 @@
#include "config.h"
#include <pwd.h>
+#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -712,7 +713,11 @@ retry:
{
#ifdef SO_PEERCRED
+#ifndef __OpenBSD__
struct ucred cr;
+#else
+ struct sockpeercred cr;
+#endif
socklen_t cr_len = sizeof(cr);
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) ==
@@ -1288,14 +1293,16 @@ FAMNextEvent(FAMConnection * fc, FAMEvent * fe)
// FIXME: drop and reacquire lock while blocked?
gamin_data_lock(conn);
- if (!gamin_data_event_ready(conn)) {
+ while ((ret = gamin_data_event_ready(conn)) == 0) {
if (gamin_read_data(conn, fc->fd, 1) < 0) {
gamin_try_reconnect(conn, fc->fd);
FAMErrno = FAM_CONNECT;
return (-1);
}
}
- ret = gamin_data_read_event(conn, fe);
+ if (ret > 0)
+ ret = gamin_data_read_event(conn, fe);
+
gamin_data_unlock(conn);
if (ret < 0) {