diff options
author | Antonio Román <kyradiscord@gmail.com> | 2022-01-12 11:39:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 11:39:49 +0300 |
commit | 74b9baa4265a8f0d112dabc3efc63c2e13276488 (patch) | |
tree | f52a6628e5da68ef9ce85b2453fc9e4098793515 /src/env.cc | |
parent | 36035e06578bcda0e10cf02d06b7930996d5201a (diff) |
v8: make writeHeapSnapshot throw if fopen fails
If the file fails to be written (e.g. missing permissions, no space left
on device, etc), `writeHeapSnapshot` will now throw an exception.
This commit also adds error handling for the `fclose` call, returning
false if a non-zero value was returned.
Fixes: https://github.com/nodejs/node/issues/41346
PR-URL: https://github.com/nodejs/node/pull/41373
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/env.cc')
-rw-r--r-- | src/env.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/env.cc b/src/env.cc index e3e06598a57..f2cb5243944 100644 --- a/src/env.cc +++ b/src/env.cc @@ -1643,7 +1643,7 @@ size_t Environment::NearHeapLimitCallback(void* data, env->isolate()->RemoveNearHeapLimitCallback(NearHeapLimitCallback, initial_heap_limit); - heap::WriteSnapshot(env->isolate(), filename.c_str()); + heap::WriteSnapshot(env, filename.c_str()); env->heap_limit_snapshot_taken_ += 1; // Don't take more snapshots than the number specified by |