Skip to content

Commit

Permalink
Merge branch 'bk138-fixes' into fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Apr 25, 2021
2 parents 613489f + 5434931 commit f29ed90
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
3 changes: 2 additions & 1 deletion client/client_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/mosquitto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/misc_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions lib/net_mosq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/time_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#endif

#ifdef WIN32
#if !(defined(_MSC_VER) && _MSC_VER <= 1500)
# define _WIN32_WINNT _WIN32_WINNT_VISTA
#endif
# include <windows.h>
#else
# include <unistd.h>
Expand Down
9 changes: 5 additions & 4 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit f29ed90

Please sign in to comment.