Allow broker to always restart on Windows when using `log_dest file`.

Closes #1080. Thanks to lcouz.
pull/1151/head
Roger A. Light 7 years ago
parent 29a1936c77
commit ab8b57ff54

@ -30,6 +30,8 @@ Broker:
- Handle mismatched handshakes (e.g. QoS1 PUBLISH with QoS2 reply) properly.
- Fix spaces not being allowed in the bridge remote_username option. Closes
#1131.
- Allow broker to always restart on Windows when using `log_dest file`. Closes
#1080.
Library:
- Fix TLS connections not working over SOCKS.

@ -404,6 +404,21 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
char username[UNLEN + 1];
int ulen = UNLEN;
SECURITY_DESCRIPTOR sd;
DWORD dwCreationDisposition;
switch(mode[0]){
case 'a':
dwCreationDisposition = OPEN_ALWAYS;
break;
case 'r':
dwCreationDisposition = OPEN_EXISTING;
break;
case 'w':
dwCreationDisposition = CREATE_ALWAYS;
break;
default:
return NULL;
}
GetUserName(username, &ulen);
if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) {
@ -424,7 +439,7 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
hfile = CreateFile(buf, GENERIC_READ | GENERIC_WRITE, 0,
&sec,
CREATE_NEW,
dwCreationDisposition,
FILE_ATTRIBUTE_NORMAL,
NULL);

Loading…
Cancel
Save