diff options
-rw-r--r-- | include/zbxtypes.h | 32 | ||||
-rw-r--r-- | src/libs/zbxcomms/comms.c | 8 |
2 files changed, 35 insertions, 5 deletions
diff --git a/include/zbxtypes.h b/include/zbxtypes.h index f8975a6b454..d89395cfcbd 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -46,6 +46,11 @@ # define ZBX_FS_UO64 "%I64o" # define ZBX_FS_UX64 "%I64x" +# define zbx_int64_t __int64 +# define ZBX_FS_I64 "%I64d" +# define ZBX_FS_O64 "%I64o" +# define ZBX_FS_X64 "%I64x" + # define snprintf _snprintf # define alloca _alloca @@ -76,6 +81,14 @@ typedef __int64 zbx_offset_t; # endif # endif +# ifndef __INT64_C +# ifdef INT64_C +# define __INT64_C(c) (INT64_C(c)) +# else +# define __INT64_C(c) (c ## LL) +# endif +# endif + # define zbx_uint64_t uint64_t # if __WORDSIZE == 64 # define ZBX_FS_UI64 "%lu" @@ -93,6 +106,23 @@ typedef __int64 zbx_offset_t; # endif # endif +# define zbx_int64_t int64_t +# if __WORDSIZE == 64 +# define ZBX_FS_I64 "%ld" +# define ZBX_FS_O64 "%lo" +# define ZBX_FS_X64 "%lx" +# else +# ifdef HAVE_LONG_LONG_QU +# define ZBX_FS_I64 "%qd" +# define ZBX_FS_O64 "%qo" +# define ZBX_FS_X64 "%qx" +# else +# define ZBX_FS_I64 "%lld" +# define ZBX_FS_O64 "%llo" +# define ZBX_FS_X64 "%llx" +# endif +# endif + # ifndef PATH_SEPARATOR # define PATH_SEPARATOR '/' # endif @@ -103,7 +133,9 @@ typedef off_t zbx_offset_t; #endif /* _WINDOWS */ #define ZBX_FS_SIZE_T ZBX_FS_UI64 +#define ZBX_FS_SSIZE_T ZBX_FS_I64 #define zbx_fs_size_t zbx_uint64_t /* use this type only in calls to printf() for formatting size_t */ +#define zbx_fs_ssize_t zbx_int64_t /* use this type only in calls to printf() for formatting ssize_t */ #ifndef S_ISREG # define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) diff --git a/src/libs/zbxcomms/comms.c b/src/libs/zbxcomms/comms.c index 74cc67552a0..2fe722a52ab 100644 --- a/src/libs/zbxcomms/comms.c +++ b/src/libs/zbxcomms/comms.c @@ -631,11 +631,9 @@ static ssize_t zbx_tls_write(zbx_socket_t *s, const char *buf, size_t len) if (0 > res) { -#if defined(_WINDOWS) - zbx_set_socket_strerror("gnutls_record_send() failed: %Id %s", res, gnutls_strerror(res)); -#else - zbx_set_socket_strerror("gnutls_record_send() failed: %zd %s", res, gnutls_strerror(res)); -#endif + zbx_set_socket_strerror("gnutls_record_send() failed: " ZBX_FS_SSIZE_T " %s", + (zbx_fs_ssize_t)res, gnutls_strerror(res)); + return ZBX_PROTO_ERROR; } |