]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: io_loop_extract_notify_fd() - Don't crash if no notifys have been added
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 19 Jul 2017 20:09:13 +0000 (23:09 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 20 Jul 2017 07:55:36 +0000 (10:55 +0300)
src/lib/ioloop-notify-inotify.c
src/lib/ioloop-notify-kqueue.c

index 08e09fab4edb95721e2a45179cb4fe46c978d85e..c8478872c9f4b5b3c1b3bda3de3f748e4d995525 100644 (file)
@@ -221,7 +221,7 @@ int io_loop_extract_notify_fd(struct ioloop *ioloop)
        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();
index 2532689ce8192d7c4452708eb7981d58fe6081a5..e7d8da52103d531b231bce5eaa623bfd1129b7e1 100644 (file)
@@ -207,7 +207,7 @@ int io_loop_extract_notify_fd(struct ioloop *ioloop)
        struct io_notify *io;
        int fd, new_kq;
 
-       if (ctx->kq == -1)
+       if (ctx == NULL || ctx->kq == -1)
                return -1;
 
        new_kq = kqueue();