Skip to content

Commit

Permalink
lib: io_loop_extract_notify_fd() - Don't crash if no notifys have bee…
Browse files Browse the repository at this point in the history
…n added
  • Loading branch information
sirainen committed Jul 20, 2017
1 parent 75c1441 commit f21d653
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/ioloop-notify-inotify.c
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ioloop-notify-kqueue.c
Expand Up @@ -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();
Expand Down

0 comments on commit f21d653

Please sign in to comment.