Skip to content

Commit

Permalink
Fix struct flock initialization
Browse files Browse the repository at this point in the history
The code currently assumes there are no additional fields to a 'struct flock',
but this is not necessarily true, for example on Solaris-derived systems.

Signed-off-by: John Levon <[email protected]>
  • Loading branch information
John Levon committed Jun 4, 2020
1 parent 3125353 commit 12a7a4e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions fs-ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,8 @@ static void EIO_Fcntl(uv_work_t *req) {
store_data_t* data = static_cast<store_data_t *>(req->data);

struct flock lk;
lk.l_start = 0;
lk.l_len = 0;
lk.l_type = 0;
lk.l_whence = 0;
lk.l_pid = 0;

memset(&lk, '\0', sizeof (lk));

int result = -1;
if (data->oper == F_GETLK || data->oper == F_SETLK || data->oper == F_SETLKW) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"flock",
"seek"
],
"version": "2.0.0",
"version": "2.0.1",
"homepage": "https://github.com/baudehlo/node-fs-ext/",
"repository": {
"type": "git",
Expand Down

0 comments on commit 12a7a4e

Please sign in to comment.