summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys-utils/flock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
index 07f3484f6..3322e142d 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -255,6 +255,7 @@ int main(int argc, char *argv[])
*/
if (!(open_flags & O_RDWR) &&
type != LOCK_SH &&
+ filename &&
access(filename, R_OK | W_OK) == 0) {
close(fd);