From: Alex Pyrgiotis Date: Fri, 1 Feb 2013 10:41:14 +0000 (+0200) Subject: Add S_IWUSR permission bit for O_CREAT X-Git-Tag: 0.3~24^2~49 X-Git-Url: https://code.grnet.gr/git/archipelago/commitdiff_plain/b782cd3d1774de6bca36c39fa30548a333af20b8 Add S_IWUSR permission bit for O_CREAT In Ubuntu -haven't tested it elsewhere yet- gcc has a global cflag called "D_FORTIFY_SOURCE=2" that errs when files are not created with explicit user permissions. Since files are O_WRONLY, I added the S_IWUSR permission bit. --- diff --git a/xseg/peers/user/peer.c b/xseg/peers/user/peer.c index b47a73f..c2a2926 100644 --- a/xseg/peers/user/peer.c +++ b/xseg/peers/user/peer.c @@ -688,7 +688,7 @@ int pidfile_read(char *path, pid_t *pid) int pidfile_open(char *path, pid_t *old_pid) { //nfs version > 3 - int fd = open(path, O_CREAT|O_EXCL|O_WRONLY); + int fd = open(path, O_CREAT|O_EXCL|O_WRONLY, S_IWUSR); if (fd < 0){ if (errno == EEXIST) pidfile_read(path, old_pid); diff --git a/xseg/peers/user/pfiled.c b/xseg/peers/user/pfiled.c index ef6d22e..adc5243 100644 --- a/xseg/peers/user/pfiled.c +++ b/xseg/peers/user/pfiled.c @@ -1093,7 +1093,7 @@ int pidfile_read(char *path, pid_t *pid) int pidfile_open(char *path, pid_t *old_pid) { //nfs version > 3 - int fd = open(path, O_CREAT|O_EXCL|O_WRONLY); + int fd = open(path, O_CREAT|O_EXCL|O_WRONLY, S_IWUSR); if (fd < 0){ if (errno == -EEXIST) pidfile_read(path, old_pid);