From b02f4b72367ef14079c7b9d8f7a35e936a231465 Mon Sep 17 00:00:00 2001
From: Anna Henningsen <anna@addaleax.net>
Date: Sat, 28 Mar 2020 14:42:51 +0100
Subject: [PATCH] report: add missing locks for report_on_fatalerror accessors

Overlooked in 2fa74e3e38bb028339e48763138456b3ed10ed97.

Refs: https://github.com/nodejs/node/pull/32207

PR-URL: https://github.com/nodejs/node/pull/32535
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
---
 src/node_report_module.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/node_report_module.cc b/src/node_report_module.cc
index a0b54d5e6004f4..700dd88aba645e 100644
--- a/src/node_report_module.cc
+++ b/src/node_report_module.cc
@@ -16,6 +16,7 @@
 
 namespace report {
 using node::Environment;
+using node::Mutex;
 using node::Utf8Value;
 using v8::Boolean;
 using v8::Context;
@@ -134,12 +135,14 @@ static void SetSignal(const FunctionCallbackInfo<Value>& info) {
 }
 
 static void ShouldReportOnFatalError(const FunctionCallbackInfo<Value>& info) {
+  Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
   info.GetReturnValue().Set(
       node::per_process::cli_options->report_on_fatalerror);
 }
 
 static void SetReportOnFatalError(const FunctionCallbackInfo<Value>& info) {
   CHECK(info[0]->IsBoolean());
+  Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
   node::per_process::cli_options->report_on_fatalerror = info[0]->IsTrue();
 }