From 9945b4ecd6c3bcb42904c4ed359dab99deb1c2d6 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 cf9559df9d0c5a..2354a1be0cd57b 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)