changeset 5018:9b8c3efa85ec HEAD

Disable dnotify silently if it's not supported by the kernel. We were missing one check.
author Timo Sirainen <tss@iki.fi>
date Wed, 17 Jan 2007 19:59:13 +0200
parents 987397c331d7
children 595dcb33802f
files src/lib/ioloop-notify-dn.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop-notify-dn.c	Wed Jan 17 18:17:42 2007 +0200
+++ b/src/lib/ioloop-notify-dn.c	Wed Jan 17 19:59:13 2007 +0200
@@ -84,7 +84,7 @@
 
 	if (fcntl(fd, F_SETSIG, SIGRTMIN) < 0) {
 		if (errno == EINVAL) {
-			/* dnotify not in kernel. disable it. */
+			/* not supported, disable dnotify */
 			ctx->disabled = TRUE;
 		} else {
 			i_error("fcntl(F_SETSIG) failed: %m");
@@ -94,10 +94,15 @@
 	}
 	if (fcntl(fd, F_NOTIFY, DN_CREATE | DN_DELETE | DN_RENAME |
 		  DN_MULTISHOT) < 0) {
-		/* we fail here if we're trying to add dnotify to
-		   non-directory fd. fail silently in that case. */
-		if (errno != ENOTDIR)
+		if (errno == ENOTDIR) {
+			/* we're trying to add dnotify to a non-directory fd.
+			   fail silently. */
+		} else if (errno == EINVAL) {
+			/* dnotify not in kernel. disable it. */
+			ctx->disabled = TRUE;
+		} else {
 			i_error("fcntl(F_NOTIFY) failed: %m");
+		}
 		(void)fcntl(fd, F_SETSIG, 0);
 		(void)close(fd);
 		return NULL;