Skip to content

Commit c7d56f5

Browse files
committed
fix lock file open mode, set umask to 022
1 parent 40c04f6 commit c7d56f5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

mach_dep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ lock_sc(void)
430430
* open lock file if not already open
431431
*/
432432
if (lock_fd < 0) {
433-
lock_fd = open(lock_path, O_RDWR|O_CREAT);
433+
lock_fd = open(lock_path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); /* more 0644 */
434434
if (lock_fd < 0) {
435435
/* failed to open and/or create the lock file */
436436
fprintf(stderr, "\nERROR: failed to open lock file: %s\n", lock_path);

main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <signal.h>
1414
#include <time.h>
1515
#include <ncurses.h>
16+
#include <sys/stat.h>
1617
#include "rogue.h"
1718
#include "score.h"
1819

@@ -28,6 +29,11 @@ main(int argc, char **argv)
2829
char *env;
2930
time_t lowtime;
3031

32+
/*
33+
* set mode for write access for the owner only
34+
*/
35+
(void) umask(S_IWGRP | S_IWOTH);
36+
3137
md_init();
3238

3339
#ifdef MASTER

0 commit comments

Comments
 (0)