Allow other apps access to log file on Windows.

This change means that users with the appropriate security permissions
can open the log file for reading at the same time that it is being
written.

Closes #515.
This commit is contained in:
Roger Light 2019-07-03 09:50:59 +01:00 committed by Roger A. Light
parent d17d7c9229
commit 2b2afc93bc
3 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,9 @@
Broker:
- Fix persistent clients being incorrectly expired on Raspberry Pis.
Closes #1272.
- Windows: Allow other applications access to the log file when running.
Closes #515.
1.6.3 - 20190618
================

View File

@ -248,7 +248,7 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
sec.bInheritHandle = FALSE;
sec.lpSecurityDescriptor = &sd;
hfile = CreateFile(buf, GENERIC_READ | GENERIC_WRITE, 0,
hfile = CreateFile(buf, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
&sec,
dwCreationDisposition,
FILE_ATTRIBUTE_NORMAL,

View File

@ -61,3 +61,11 @@ command line as follows:
C:\Program Files\mosquitto\mosquitto install
C:\Program Files\mosquitto\mosquitto uninstall
Logging
-------
If you use `log_dest file ...` in your configuration, the log file will be
created with security permissions for the current user only. If running as a
service, this means the SYSTEM user. You will only be able to view the log file
if you add permissions for yourself or whatever user you wish to view the logs.