Skip to content
Commits on Source (4)
......@@ -642,7 +642,7 @@ int tcp_emu(struct socket *so, struct mbuf *m)
}
NTOHS(n1);
NTOHS(n2);
m_inc(m, snprintf(NULL, 0, "%d,%d\r\n", n1, n2) + 1);
m_inc(m, g_snprintf(NULL, 0, "%d,%d\r\n", n1, n2) + 1);
m->m_len = slirp_fmt(m->m_data, M_ROOM(m), "%d,%d\r\n", n1, n2);
} else {
*eol = '\r';
......
......@@ -368,10 +368,10 @@ void slirp_pstrcpy(char *buf, int buf_size, const char *str)
static int slirp_vsnprintf(char *str, size_t size,
const char *format, va_list args)
{
int rv = vsnprintf(str, size, format, args);
int rv = g_vsnprintf(str, size, format, args);
if (rv < 0) {
g_error("vsnprintf() failed: %s", g_strerror(errno));
g_error("g_vsnprintf() failed: %s", g_strerror(errno));
}
return rv;
......@@ -393,7 +393,7 @@ int slirp_fmt(char *str, size_t size, const char *format, ...)
va_end(args);
if (rv > size) {
g_critical("vsnprintf() truncation");
g_critical("slirp_fmt() truncation");
}
return MIN(rv, size);
......@@ -416,7 +416,7 @@ int slirp_fmt0(char *str, size_t size, const char *format, ...)
va_end(args);
if (rv >= size) {
g_critical("vsnprintf() truncation");
g_critical("slirp_fmt0() truncation");
if (size > 0)
str[size - 1] = '\0';
rv = size;
......
......@@ -24,6 +24,8 @@
#ifndef UTIL_H_
#define UTIL_H_
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
......@@ -181,7 +183,7 @@ static inline int slirp_socket_set_fast_reuse(int fd)
void slirp_pstrcpy(char *buf, int buf_size, const char *str);
int slirp_fmt(char *str, size_t size, const char *format, ...);
int slirp_fmt0(char *str, size_t size, const char *format, ...);
int slirp_fmt(char *str, size_t size, const char *format, ...) G_GNUC_PRINTF(3, 4);
int slirp_fmt0(char *str, size_t size, const char *format, ...) G_GNUC_PRINTF(3, 4);
#endif