changeset 22369:98652f62dbf5

lib: io_loop_extract_notify_fd() - Don't crash if no notifys have been added
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 19 Jul 2017 23:09:13 +0300
parents faadf17a3baa
children f51eb78b45f2
files src/lib/ioloop-notify-inotify.c src/lib/ioloop-notify-kqueue.c
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop-notify-inotify.c	Wed Jul 19 10:37:25 2017 +0300
+++ b/src/lib/ioloop-notify-inotify.c	Wed Jul 19 23:09:13 2017 +0300
@@ -221,7 +221,7 @@
 	struct io_notify *io;
 	int fd, new_inotify_fd;
 
-	if (ctx->inotify_fd == -1)
+	if (ctx == NULL || ctx->inotify_fd == -1)
 		return -1;
 
 	new_inotify_fd = inotify_init();
--- a/src/lib/ioloop-notify-kqueue.c	Wed Jul 19 10:37:25 2017 +0300
+++ b/src/lib/ioloop-notify-kqueue.c	Wed Jul 19 23:09:13 2017 +0300
@@ -207,7 +207,7 @@
 	struct io_notify *io;
 	int fd, new_kq;
 
-	if (ctx->kq == -1)
+	if (ctx == NULL || ctx->kq == -1)
 		return -1;
 
 	new_kq = kqueue();