Create json files with mode 0644 - umask.

mkstemp defaults to 0600 which is not so useful for serving the file.
This commit is contained in:
Oliver Jowett 2014-11-23 16:32:45 +00:00
parent d0174994cb
commit ebab2c0e11

View file

@ -703,6 +703,7 @@ void modesWriteJson(const char *path)
int fd; int fd;
int len = 0; int len = 0;
char *content; char *content;
mode_t mask;
snprintf(tmppath, PATH_MAX, "%s.XXXXXX", path); snprintf(tmppath, PATH_MAX, "%s.XXXXXX", path);
tmppath[PATH_MAX-1] = 0; tmppath[PATH_MAX-1] = 0;
@ -710,6 +711,10 @@ void modesWriteJson(const char *path)
if (fd < 0) if (fd < 0)
return; return;
mask = umask(0);
umask(mask);
fchmod(fd, 0644 & ~mask);
content = aircraftsToJson(&len); content = aircraftsToJson(&len);
if (write(fd, content, len) != len) if (write(fd, content, len) != len)
goto error_1; goto error_1;