Merge branch 'write-json-files' into oversampling
This commit is contained in:
commit
e0bc89e542
|
@ -832,7 +832,7 @@ int main(int argc, char **argv) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
} else if (!strcmp(argv[j], "--write-json") && more) {
|
} else if (!strcmp(argv[j], "--write-json") && more) {
|
||||||
++j;
|
++j;
|
||||||
Modes.json_path = malloc(strlen(argv[j]) + 11);
|
Modes.json_path = malloc(strlen(argv[j]) + 15);
|
||||||
strcpy(Modes.json_path, argv[j]);
|
strcpy(Modes.json_path, argv[j]);
|
||||||
strcat(Modes.json_path, "/aircraft.json");
|
strcat(Modes.json_path, "/aircraft.json");
|
||||||
} else if (!strcmp(argv[j], "--write-json-every") && more) {
|
} else if (!strcmp(argv[j], "--write-json-every") && more) {
|
||||||
|
|
5
net_io.c
5
net_io.c
|
@ -734,6 +734,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;
|
||||||
|
@ -741,6 +742,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;
|
||||||
|
|
Loading…
Reference in a new issue