Restore old umask after creating file.

pull/459/head
Roger A. Light 8 years ago
parent 6e7d02ba16
commit 94978ac89b

@ -404,9 +404,17 @@ FILE *_mosquitto_fopen(const char *path, const char *mode, bool restrict_read)
} }
#else #else
if (restrict_read) { if (restrict_read) {
umask(0700); FILE *fptr;
} mode_t old_mask;
old_mask = umask(0700);
fptr = fopen(path, mode);
umask(old_mask);
return fptr;
}else{
return fopen(path, mode); return fopen(path, mode);
}
#endif #endif
} }

Loading…
Cancel
Save