From 67937bca0a13c25aeecbeffa1f5aa4bdf72d0c15 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 a9f96389121c9e..cd6dc417ba2460 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -85,6 +85,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); FSEventWrap* wrap = Unwrap(args.Holder()); + CHECK_EQ(wrap->initialized_, false); if (args.Length() < 1 || !args[0]->IsString()) { return env->ThrowTypeError("filename must be a valid string");