From 61788b8a5864364bd45ff8ec4eab830093878406 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Sat, 3 Dec 2016 18:32:32 +1000 Subject: [PATCH] * use open() with explicit file mode --- src/statefile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/statefile.c b/src/statefile.c index 990528d..5e126c9 100644 --- a/src/statefile.c +++ b/src/statefile.c @@ -25,7 +25,8 @@ f2b_statefile_create(const char *statedir, const char *jailname) { f2b_log_msg(log_error, "can't access statefile: %s", strerror(errno)); return NULL; } - int fd = open(path, O_CREAT | O_WRONLY); + mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP; /* 0640 */ + int fd = open(path, O_CREAT | O_WRONLY, mode); if (fd < 0) { f2b_log_msg(log_error, "can't create statefile: %s", strerror(errno)); return NULL;