From c21620d3e684c86e86a46fc8afa814910f97ff7c Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Wed, 17 Aug 2011 11:28:32 +0000 Subject: [PATCH] terminate in case of no-sace-left-on-device when adding a user watch. ignore all other errors --- inotify.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inotify.c b/inotify.c index 3eebeed..5c65e16 100644 --- a/inotify.c +++ b/inotify.c @@ -100,6 +100,13 @@ l_addwatch(lua_State *L) int wd = inotify_add_watch(inotify_fd, path, mask); if (wd < 0) { + if (errno == ENOSPC) { + printlogf(L, "Error", +"Terminating since out of inotify watches."); + printlogf(L, "Error", +"Consider increasing /proc/sys/fs/inotify/max_user_watches"); + exit(-1); // ERRNO. + } printlogf(L, "Inotify", "addwatch(%s)->%d; err=%d:%s", path, wd, errno, strerror(errno)); } else {