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.
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);
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);