])
if test x$have_filemonitor != xno ; then
- AC_CHECK_FUNCS(inotify_init1 inotify_add_watch inotify_rm_watch,
+ AC_CHECK_FUNCS(inotify_init inotify_add_watch inotify_rm_watch,
[], [have_filemonitor=no])
if test x$have_filemonitor != xno ; then
AC_DEFINE(USE_INOTIFY,1,[ Define if want to use inotify for filesystem monitoring (available in Linux only). ])
+ AC_CHECK_FUNCS_ONCE(inotify_init1)
AC_CHECK_HEADERS(sys/inotify.h)
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS monitor.o"
fi
# include <unistd.h>
# include <poll.h>
#endif
+#ifndef HAVE_INOTIFY_INIT1
+# include <fcntl.h>
+#endif
#include "mutt.h"
#include "buffy.h"
{
if (INotifyFd == -1)
{
+#if HAVE_INOTIFY_INIT1
INotifyFd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (INotifyFd == -1)
{
dprint (2, (debugfile, "monitor: inotify_init1 failed, errno=%d %s\n", errno, strerror(errno)));
return -1;
}
+#else
+ INotifyFd = inotify_init();
+ if (INotifyFd == -1)
+ {
+ dprint (2, (debugfile, "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);
}
/*
- * Copyright (C) 2018 Gero Treuer <gero@70t.de>
+ * Copyright (C) 2018 Gero Treuner <gero@70t.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by