Browse Source

* use open() with explicit file mode

master
Alex 'AdUser' Z 8 years ago
parent
commit
61788b8a58
  1. 3
      src/statefile.c

3
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)); f2b_log_msg(log_error, "can't access statefile: %s", strerror(errno));
return NULL; 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) { if (fd < 0) {
f2b_log_msg(log_error, "can't create statefile: %s", strerror(errno)); f2b_log_msg(log_error, "can't create statefile: %s", strerror(errno));
return NULL; return NULL;

Loading…
Cancel
Save