From a0bf841be226ae631f706cef77cfab81a5e77abe Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 16 May 2014 12:54:52 +0800 Subject: [PATCH] Check for non-negative watch object in inotify_add_watch --- fish_tests.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fish_tests.cpp b/fish_tests.cpp index 3b738d66b..65a2484da 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -2407,8 +2407,12 @@ static bool test_basic_inotify_support() err(L"touch failed"); } - /* add file to watch list */ + /* Add file to watch list */ int wd = inotify_add_watch(fd, INOTIFY_TEST_PATH, IN_DELETE); + if (wd < 0) + { + err(L"inotify_add_watch failed: %s", strerror(errno)); + } /* Delete file */ if (system("rm " INOTIFY_TEST_PATH))