Merge branch 'bk138-fixes' into fixes

This commit is contained in:
Roger Light
2021-04-25 22:12:37 +01:00
7 changed files with 26 additions and 8 deletions
+2 -1
View File
@@ -756,8 +756,9 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
tmp = strchr(url, '@');
if(tmp) {
char *colon;
*tmp++ = 0;
char *colon = strchr(url, ':');
colon = strchr(url, ':');
if(colon) {
*colon = 0;
cfg->password = strdup(colon + 1);
+9
View File
@@ -33,6 +33,15 @@
#if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf sprintf_s
# define EPROTO ECONNABORTED
# ifndef ECONNABORTED
# define ECONNABORTED WSAECONNABORTED
# endif
# ifndef ENOTCONN
# define ENOTCONN WSAENOTCONN
# endif
# ifndef ECONNREFUSED
# define ECONNREFUSED WSAECONNREFUSED
# endif
#endif
#ifdef WIN32
+1 -1
View File
@@ -49,7 +49,7 @@ extern "C" {
# define libmosq_EXPORT
#endif
#if defined(_MSC_VER) && _MSC_VER < 1900
#if defined(_MSC_VER) && _MSC_VER < 1900 && !defined(bool)
# ifndef __cplusplus
# define bool char
# define true 1
+4 -2
View File
@@ -57,6 +57,8 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
DWORD ulen = UNLEN;
SECURITY_DESCRIPTOR sd;
DWORD dwCreationDisposition;
int fd;
FILE *fptr;
switch(mode[0]){
case 'a':
@@ -97,12 +99,12 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
LocalFree(pacl);
int fd = _open_osfhandle((intptr_t)hfile, 0);
fd = _open_osfhandle((intptr_t)hfile, 0);
if (fd < 0) {
return NULL;
}
FILE *fptr = _fdopen(fd, mode);
fptr = _fdopen(fd, mode);
if (!fptr) {
_close(fd);
return NULL;
+3
View File
@@ -36,6 +36,9 @@ typedef SSIZE_T ssize_t;
# define COMPAT_ECONNRESET WSAECONNRESET
# define COMPAT_EINTR WSAEINTR
# define COMPAT_EWOULDBLOCK WSAEWOULDBLOCK
# ifndef EINPROGRESS
# define EINPROGRESS WSAEINPROGRESS
# endif
#else
# define COMPAT_CLOSE(a) close(a)
# define COMPAT_ECONNRESET ECONNRESET
+2
View File
@@ -24,7 +24,9 @@ Contributors:
#endif
#ifdef WIN32
#if !(defined(_MSC_VER) && _MSC_VER <= 1500)
# define _WIN32_WINNT _WIN32_WINNT_VISTA
#endif
# include <windows.h>
#else
# include <unistd.h>
+5 -4
View File
@@ -2028,15 +2028,16 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
#endif
}else if(!strcmp(token, "topic")){
#ifdef WITH_BRIDGE
char *topic = NULL;
enum mosquitto__bridge_direction direction = bd_out;
uint8_t qos = 0;
char *local_prefix = NULL, *remote_prefix = NULL;
if(reload) continue; /* FIXME */
if(!cur_bridge){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
return MOSQ_ERR_INVAL;
}
char *topic = NULL;
enum mosquitto__bridge_direction direction = bd_out;
uint8_t qos = 0;
char *local_prefix = NULL, *remote_prefix = NULL;
token = strtok_r(NULL, " ", &saveptr);
if(token){