From bc31f0b6ac521f1ca1e127aee16cb8a9e5a06dbc Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 21 May 2020 15:52:23 +0000 Subject: [PATCH] Fix struct flock initialization 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 --- fs-ext.cc | 7 +------ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/fs-ext.cc b/fs-ext.cc index 95088bd..7f15d3b 100644 --- a/fs-ext.cc +++ b/fs-ext.cc @@ -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(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) { diff --git a/package-lock.json b/package-lock.json index d4bf8e0..6fdb85e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fs-ext", - "version": "1.3.0", + "version": "2.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 157b375..466f9cd 100644 --- a/package.json +++ b/package.json @@ -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",