###############################################################################
# INOTIFY
if {[get-define want-inotify]} {
- if {[cc-check-functions inotify_add_watch inotify_init1 inotify_rm_watch]} {
- if {[cc-check-includes sys/inotify.h]} {
- define USE_INOTIFY
- }
+ if {[cc-check-functions inotify_add_watch inotify_init inotify_rm_watch]} {
+ define USE_INOTIFY
+ cc-check-functions inotify_init1
+ cc-check-includes sys/inotify.h
}
}
#include "context.h"
#include "curs_lib.h"
#include "globals.h"
+#ifndef HAVE_INOTIFY_INIT1
+#include <fcntl.h>
+#endif
bool MonitorFilesChanged = false;
bool MonitorContextChanged = false;
{
if (INotifyFd == -1)
{
+#if HAVE_INOTIFY_INIT1
INotifyFd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (INotifyFd == -1)
{
mutt_debug(LL_DEBUG2, "inotify_init1 failed, errno=%d %s\n", errno, strerror(errno));
return -1;
}
+#else
+ INotifyFd = inotify_init();
+ if (INotifyFd == -1)
+ {
+ mutt_debug(LL_DEBUG2, "monitor: inotify_init failed, errno=%d %s\n",
+ errno, strerror(errno));
+ return -1;
+ }
+ fcntl(INotifyFd, F_SETFL, O_NONBLOCK);
+ fcntl(INotifyFd, F_SETFD, FD_CLOEXEC);
+#endif
mutt_poll_fd_add(0, POLLIN);
mutt_poll_fd_add(INotifyFd, POLLIN);
}
* Monitor files for changes
*
* @authors
- * Copyright (C) 2018 Gero Treuer <gero@70t.de>
+ * Copyright (C) 2018 Gero Treuner <gero@70t.de>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under