summaryrefslogtreecommitdiff
path: root/deps/uvwasi
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2020-01-21 09:29:36 -0500
committerRich Trott <rtrott@gmail.com>2020-01-23 05:22:23 -0800
commit28bee2444e4d30b762a031958855a601aec27fe1 (patch)
treebe9ccddcdd4e3e4302e0e6eb1499e88e288b3e72 /deps/uvwasi
parent8b606d3e264f1157e5f5da7ced7983a347cda8e8 (diff)
downloadnode-new-28bee2444e4d30b762a031958855a601aec27fe1.tar.gz
deps: uvwasi: cherry-pick ea73af5
Original commit message: unlock all fd mutexes in reverse order Some functions acquire mutexes for multiple file descriptors. This commit ensures that the mutexes are released in the reverse order that they are aquired. PR-URL: https://github.com/nodejs/node/pull/31432 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/uvwasi')
-rw-r--r--deps/uvwasi/src/fd_table.c2
-rw-r--r--deps/uvwasi/src/uvwasi.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/deps/uvwasi/src/fd_table.c b/deps/uvwasi/src/fd_table.c
index b6a43f0370..e4897769d9 100644
--- a/deps/uvwasi/src/fd_table.c
+++ b/deps/uvwasi/src/fd_table.c
@@ -366,8 +366,8 @@ uvwasi_errno_t uvwasi_fd_table_renumber(struct uvwasi_s* uvwasi,
r = uv_fs_close(NULL, &req, dst_entry->fd, NULL);
uv_fs_req_cleanup(&req);
if (r != 0) {
- uv_mutex_unlock(&dst_entry->mutex);
uv_mutex_unlock(&src_entry->mutex);
+ uv_mutex_unlock(&dst_entry->mutex);
err = uvwasi__translate_uv_error(r);
goto exit;
}
diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c
index 5a73bfee77..e4c2ac6e3b 100644
--- a/deps/uvwasi/src/uvwasi.c
+++ b/deps/uvwasi/src/uvwasi.c
@@ -1821,9 +1821,9 @@ uvwasi_errno_t uvwasi_path_link(uvwasi_t* uvwasi,
err = UVWASI_ESUCCESS;
exit:
- uv_mutex_unlock(&old_wrap->mutex);
+ uv_mutex_unlock(&new_wrap->mutex);
if (old_fd != new_fd)
- uv_mutex_unlock(&new_wrap->mutex);
+ uv_mutex_unlock(&old_wrap->mutex);
return err;
}
@@ -2136,9 +2136,9 @@ uvwasi_errno_t uvwasi_path_rename(uvwasi_t* uvwasi,
err = UVWASI_ESUCCESS;
exit:
- uv_mutex_unlock(&old_wrap->mutex);
+ uv_mutex_unlock(&new_wrap->mutex);
if (old_fd != new_fd)
- uv_mutex_unlock(&new_wrap->mutex);
+ uv_mutex_unlock(&old_wrap->mutex);
return err;
}