From e159bf5f31638b064fc5bf49376bb4c60dc38aee Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Thu, 25 Nov 2010 22:13:57 +0000 Subject: [PATCH] better wary coding --- inotify.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inotify.c b/inotify.c index 9505815..8ec7859 100644 --- a/inotify.c +++ b/inotify.c @@ -319,7 +319,13 @@ inotify_ready(lua_State *L, struct observance *observance) static void inotify_tidy(struct observance *observance) { - close(observance->fd); + if (observance->fd != inotify_fd) { + logstring("Error", + "internal fail, inotify_ready on non-inotify file descriptor."); + exit(-1); // ERRNO + } + close(inotify_fd); + inotify_fd = -1; free(readbuf); readbuf = NULL; }