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 May 21, 2020
1 parent 3125353 commit bc31f0b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions fs-ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,7 @@ static void EIO_Seek(uv_work_t *req) {
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;
struct flock 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 bc31f0b

Please sign in to comment.