From 57387fa29f130b5fae28b50c935e61665a37f9ff Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 22 Jun 2016 13:17:03 +0200 Subject: [PATCH] src: guard against starting fs watcher twice This commit adds a CHECK that verifies that the file event watcher is not started twice, which would be indicative of a bug in lib/fs.js. PR-URL: https://github.com/nodejs/node/pull/7374 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- src/fs_event_wrap.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index cf9559df9d..2354a1be0c 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -88,6 +88,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo& args) { FSEventWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); + CHECK_EQ(wrap->initialized_, false); static const char kErrMsg[] = "filename must be a string or Buffer"; if (args.Length() < 1)