aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c156
1 files changed, 78 insertions, 78 deletions
diff --git a/dumpcap.c b/dumpcap.c
index fbc8a76db0..d4baf7a30b 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -642,10 +642,10 @@ get_capture_device_open_failure_messages(cap_device_open_status open_status,
char *secondary_errmsg,
size_t secondary_errmsg_len)
{
- g_snprintf(errmsg, (gulong) errmsg_len,
+ snprintf(errmsg, (gulong) errmsg_len,
"The capture session could not be initiated on capture device \"%s\" (%s).",
iface, open_status_str);
- g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, "%s",
+ snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, "%s",
get_pcap_failure_secondary_error_message(open_status, open_status_str));
}
@@ -725,7 +725,7 @@ show_filter_code(capture_options *capture_opts)
/* OK, try to compile the capture filter. */
if (!compile_capture_filter(interface_opts->name, pcap_h, &fcode,
interface_opts->cfilter)) {
- g_snprintf(errmsg, sizeof(errmsg), "%s", pcap_geterr(pcap_h));
+ snprintf(errmsg, sizeof(errmsg), "%s", pcap_geterr(pcap_h));
pcap_close(pcap_h);
report_cfilter_error(capture_opts, j, errmsg);
return FALSE;
@@ -1363,7 +1363,7 @@ cap_open_socket(char *pipename, capture_src *pcap_src, char *errmsg, size_t errm
/* Skip the initial "TCP@" in the pipename. */
if (ws_socket_ptoa(&sa, pipename + 4, DEF_TCP_PORT) < 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated because"
"\"%s\" is not a valid socket specification", pipename);
pcap_src->cap_pipe_err = PIPERR;
@@ -1371,7 +1371,7 @@ cap_open_socket(char *pipename, capture_src *pcap_src, char *errmsg, size_t errm
}
if ((fd = (int)socket(sa.ss_family, SOCK_STREAM, 0)) < 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated because"
" the socket couldn't be created due to the socket error: \n"
#ifdef _WIN32
@@ -1388,7 +1388,7 @@ cap_open_socket(char *pipename, capture_src *pcap_src, char *errmsg, size_t errm
else
sa_len = sizeof(struct sockaddr_in);
if (connect(fd, (struct sockaddr *)&sa, sa_len) < 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated because"
" the socket couldn't be connected due to the socket error: \n"
#ifdef _WIN32
@@ -1447,14 +1447,14 @@ cap_pipe_read_data_bytes(capture_src *pcap_src, char *errmsg, size_t errmsgl)
sz = pcap_src->cap_pipe_bytes_to_read - pcap_src->cap_pipe_bytes_read;
while (bytes_read < sz) {
if (fd == -1) {
- g_snprintf(errmsg, (gulong)errmsgl, "Invalid file descriptor.");
+ snprintf(errmsg, (gulong)errmsgl, "Invalid file descriptor.");
pcap_src->cap_pipe_err = PIPNEXIST;
return -1;
}
sel_ret = cap_pipe_select(fd);
if (sel_ret < 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Unexpected error from select: %s.", g_strerror(errno));
pcap_src->cap_pipe_err = PIPERR;
return -1;
@@ -1463,7 +1463,7 @@ cap_pipe_read_data_bytes(capture_src *pcap_src, char *errmsg, size_t errmsgl)
sz-bytes_read, pcap_src->from_cap_socket);
if (b <= 0) {
if (b == 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file reading from pipe or socket.");
pcap_src->cap_pipe_err = PIPEOF;
} else {
@@ -1473,11 +1473,11 @@ cap_pipe_read_data_bytes(capture_src *pcap_src, char *errmsg, size_t errmsgl)
*/
DWORD lastError = WSAGetLastError();
errno = lastError;
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error reading from pipe or socket: %s.",
win32strerror(lastError));
#else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error reading from pipe or socket: %s.",
g_strerror(errno));
#endif
@@ -1566,7 +1566,7 @@ cap_pipe_open_live(char *pipename,
if (errno == ENOENT || errno == ENOTDIR)
pcap_src->cap_pipe_err = PIPNEXIST;
else {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated "
"due to error getting information on pipe or socket: %s.", g_strerror(errno));
pcap_src->cap_pipe_err = PIPERR;
@@ -1576,7 +1576,7 @@ cap_pipe_open_live(char *pipename,
if (S_ISFIFO(pipe_stat.st_mode)) {
fd = ws_open(pipename, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
if (fd == -1) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated "
"due to error on pipe open: %s.", g_strerror(errno));
pcap_src->cap_pipe_err = PIPERR;
@@ -1585,7 +1585,7 @@ cap_pipe_open_live(char *pipename,
} else if (S_ISSOCK(pipe_stat.st_mode)) {
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated "
"due to error on socket create: %s.", g_strerror(errno));
pcap_src->cap_pipe_err = PIPERR;
@@ -1617,7 +1617,7 @@ cap_pipe_open_live(char *pipename,
*/
if (g_strlcpy(sa.sun_path, pipename, sizeof sa.sun_path) > sizeof sa.sun_path) {
/* Path name too long */
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session coud not be initiated "
"due to error on socket connect: Path name too long.");
pcap_src->cap_pipe_err = PIPERR;
@@ -1626,7 +1626,7 @@ cap_pipe_open_live(char *pipename,
}
b = connect(fd, (struct sockaddr *)&sa, sizeof sa);
if (b == -1) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session coud not be initiated "
"due to error on socket connect: %s.", g_strerror(errno));
pcap_src->cap_pipe_err = PIPERR;
@@ -1641,7 +1641,7 @@ cap_pipe_open_live(char *pipename,
*/
pcap_src->cap_pipe_err = PIPNEXIST;
} else {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated because\n"
"\"%s\" is neither an interface nor a socket nor a pipe.", pipename);
pcap_src->cap_pipe_err = PIPERR;
@@ -1650,7 +1650,7 @@ cap_pipe_open_live(char *pipename,
}
#else /* _WIN32 */
- if (sscanf(pipename, EXTCAP_PIPE_PREFIX "%" G_GUINTPTR_FORMAT, &extcap_pipe_handle) == 1)
+ if (sscanf(pipename, EXTCAP_PIPE_PREFIX "%" PRIuPTR, &extcap_pipe_handle) == 1)
{
/* The client is already connected to extcap pipe.
* We have inherited the handle from parent process.
@@ -1674,7 +1674,7 @@ cap_pipe_open_live(char *pipename,
g_free(pncopy);
if (!pos) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session could not be initiated because\n"
"\"%s\" is neither an interface nor a pipe.", pipename);
pcap_src->cap_pipe_err = PIPNEXIST;
@@ -1691,7 +1691,7 @@ cap_pipe_open_live(char *pipename,
break;
if (GetLastError() != ERROR_PIPE_BUSY) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session on \"%s\" could not be started "
"due to error on pipe open: %s.",
pipename, win32strerror(GetLastError()));
@@ -1700,7 +1700,7 @@ cap_pipe_open_live(char *pipename,
}
if (!WaitNamedPipe(utf_8to16(pipename), 30 * 1000)) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The capture session on \"%s\" timed out during "
"pipe open: %s.",
pipename, win32strerror(GetLastError()));
@@ -1747,7 +1747,7 @@ cap_pipe_open_live(char *pipename,
while (bytes_read < sizeof magic) {
sel_ret = cap_pipe_select(fd);
if (sel_ret < 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Unexpected error from select: %s.",
g_strerror(errno));
goto error;
@@ -1761,10 +1761,10 @@ cap_pipe_open_live(char *pipename,
if (b <= 0) {
if (b == 0)
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file on pipe magic during open.");
else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error on pipe magic during open: %s.",
g_strerror(errno));
goto error;
@@ -1785,10 +1785,10 @@ cap_pipe_open_live(char *pipename,
if (pcap_src->cap_pipe_bytes_read <= 0) {
if (pcap_src->cap_pipe_bytes_read == 0)
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file on pipe magic during open.");
else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error on pipe magic during open: %s.",
g_strerror(errno));
goto error;
@@ -1841,9 +1841,9 @@ cap_pipe_open_live(char *pipename,
default:
/* Not a pcapng file, and either not a pcap type we know about
or not a pcap file, either. */
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Data written to the pipe is neither in a supported pcap format nor in pcapng format.");
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsgl, "%s",
+ snprintf(secondary_errmsg, (gulong)secondary_errmsgl, "%s",
not_our_bug);
goto error;
}
@@ -1898,7 +1898,7 @@ pcap_pipe_open_live(int fd,
while (bytes_read < sizeof(struct pcap_hdr)) {
sel_ret = cap_pipe_select(fd);
if (sel_ret < 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Unexpected error from select: %s.",
g_strerror(errno));
goto error;
@@ -1908,13 +1908,13 @@ pcap_pipe_open_live(int fd,
pcap_src->from_cap_socket);
if (b <= 0) {
if (b == 0)
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file on pipe header during open.");
else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error on pipe header during open: %s.",
g_strerror(errno));
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsgl,
+ snprintf(secondary_errmsg, (gulong)secondary_errmsgl,
"%s", not_our_bug);
goto error;
}
@@ -1927,13 +1927,13 @@ pcap_pipe_open_live(int fd,
pipe_read_sync(pcap_src, hdr, sizeof(struct pcap_hdr));
if (pcap_src->cap_pipe_bytes_read <= 0) {
if (pcap_src->cap_pipe_bytes_read == 0)
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file on pipe header during open.");
else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error on pipe header header during open: %s.",
g_strerror(errno));
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsgl, "%s",
+ snprintf(secondary_errmsg, (gulong)secondary_errmsgl, "%s",
not_our_bug);
goto error;
}
@@ -1969,10 +1969,10 @@ pcap_pipe_open_live(int fd,
}
if (hdr->version_major < 2) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"The old pcap format version %d.%d is not supported.",
hdr->version_major, hdr->version_minor);
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsgl, "%s",
+ snprintf(secondary_errmsg, (gulong)secondary_errmsgl, "%s",
not_our_bug);
goto error;
}
@@ -2016,10 +2016,10 @@ pcapng_read_shb(capture_src *pcap_src,
sizeof(pcapng_section_header_block_t));
if (pcap_src->cap_pipe_bytes_read <= 0) {
if (pcap_src->cap_pipe_bytes_read == 0)
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file reading from pipe or socket.");
else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error reading from pipe or socket: %s.",
g_strerror(errno));
return -1;
@@ -2069,13 +2069,13 @@ pcapng_read_shb(capture_src *pcap_src,
#define OUR_ENDIAN "little"
#define IFACE_ENDIAN "big"
#endif
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Interface %u is " IFACE_ENDIAN " endian but we're " OUR_ENDIAN " endian.",
pcap_src->interface_id);
return -1;
default:
/* Not a pcapng type we know about, or not pcapng at all. */
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Unrecognized pcapng format or not pcapng data.");
return -1;
}
@@ -2229,10 +2229,10 @@ pcapng_pipe_open_live(int fd,
sizeof(bh->block_total_length));
if (pcap_src->cap_pipe_bytes_read <= 0) {
if (pcap_src->cap_pipe_bytes_read == 0)
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"End of file reading from pipe or socket.");
else
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Error reading from pipe or socket: %s.",
g_strerror(errno));
goto error;
@@ -2243,7 +2243,7 @@ pcapng_pipe_open_live(int fd,
}
#endif
if ((bh->block_total_length & 0x03) != 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"block_total_length read from pipe is %u, which is not a multiple of 4.",
bh->block_total_length);
goto error;
@@ -2400,7 +2400,7 @@ pcap_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t er
break;
default:
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"pcap_pipe_dispatch: invalid state");
result = PD_ERR;
@@ -2425,7 +2425,7 @@ pcap_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t er
* STATE_EXPECT_DATA) as that would not fit in the buffer and
* instead stop with an error.
*/
- g_snprintf(errmsg, (gulong)errmsgl, "Frame %u too long (%d bytes)",
+ snprintf(errmsg, (gulong)errmsgl, "Frame %u too long (%d bytes)",
ld->packets_captured+1, pcap_info->rechdr.hdr.incl_len);
break;
}
@@ -2492,7 +2492,7 @@ pcap_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t er
return -1;
case PD_PIPE_ERR:
- g_snprintf(errmsg, (gulong)errmsgl, "Error reading from pipe: %s",
+ snprintf(errmsg, (gulong)errmsgl, "Error reading from pipe: %s",
#ifdef _WIN32
win32strerror(GetLastError()));
#else
@@ -2636,7 +2636,7 @@ pcapng_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t
break;
default:
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"pcapng_pipe_dispatch: invalid state");
result = PD_ERR;
@@ -2667,7 +2667,7 @@ pcapng_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t
}
if ((bh->block_total_length & 0x03) != 0) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"Total length of pcapng block read from pipe is %u, which is not a multiple of 4.",
bh->block_total_length);
break;
@@ -2679,7 +2679,7 @@ pcapng_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t
* STATE_EXPECT_DATA) as that would not fit in the buffer and
* instead stop with an error.
*/
- g_snprintf(errmsg, (gulong)errmsgl, "Frame %u too long (%d bytes)",
+ snprintf(errmsg, (gulong)errmsgl, "Frame %u too long (%d bytes)",
ld->packets_captured+1, bh->block_total_length);
break;
}
@@ -2706,7 +2706,7 @@ pcapng_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t
/* The record always has at least the block total length following the header */
if (bh->block_total_length < sizeof(pcapng_block_header_t)+sizeof(guint32)) {
- g_snprintf(errmsg, (gulong)errmsgl,
+ snprintf(errmsg, (gulong)errmsgl,
"malformed pcapng block_total_length < minimum");
pcap_src->cap_pipe_err = PIPEOF;
return -1;
@@ -2740,7 +2740,7 @@ pcapng_pipe_dispatch(loop_data *ld, capture_src *pcap_src, char *errmsg, size_t
return -1;
case PD_PIPE_ERR:
- g_snprintf(errmsg, (gulong)errmsgl, "Error reading from pipe: %s",
+ snprintf(errmsg, (gulong)errmsgl, "Error reading from pipe: %s",
#ifdef _WIN32
win32strerror(GetLastError()));
#else
@@ -2773,7 +2773,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
if ((use_threads == FALSE) &&
(capture_opts->ifaces->len > 1)) {
- g_snprintf(errmsg, (gulong) errmsg_len,
+ snprintf(errmsg, (gulong) errmsg_len,
"Using threads is required for capturing on multiple interfaces.");
return FALSE;
}
@@ -2783,7 +2783,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
pcap_src = g_new0(capture_src, 1);
if (pcap_src == NULL) {
- g_snprintf(errmsg, (gulong) errmsg_len,
+ snprintf(errmsg, (gulong) errmsg_len,
"Could not allocate memory.");
return FALSE;
}
@@ -3176,7 +3176,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
if ((capture_opts->use_pcapng == FALSE) &&
(capture_opts->ifaces->len > 1)) {
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"Using PCAPNG is required for capturing on multiple interfaces. Use the -n option.");
return FALSE;
}
@@ -3232,12 +3232,12 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
/* We couldn't set up to write to the capture file. */
/* XXX - use cf_open_error_message from tshark instead? */
if (err < 0) {
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"The file to which the capture would be"
" saved (\"%s\") could not be opened: Error %d.",
capture_opts->save_file, err);
} else {
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"The file to which the capture would be"
" saved (\"%s\") could not be opened: %s.",
capture_opts->save_file, g_strerror(err));
@@ -3333,7 +3333,7 @@ capture_loop_dispatch(loop_data *ld,
sel_ret = cap_pipe_select(pcap_src->cap_pipe_fd);
if (sel_ret <= 0) {
if (sel_ret < 0 && errno != EINTR) {
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"Unexpected error from select: %s", g_strerror(errno));
report_capture_error(errmsg, please_report_bug());
ld->go = FALSE;
@@ -3406,7 +3406,7 @@ capture_loop_dispatch(loop_data *ld,
}
} else {
if (sel_ret < 0 && errno != EINTR) {
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"Unexpected error from select: %s", g_strerror(errno));
report_capture_error(errmsg, please_report_bug());
ld->go = FALSE;
@@ -3543,7 +3543,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
if (capture_opts->output_to_pipe == TRUE) { /* either "-" or named pipe */
if (capture_opts->multi_files_on) {
/* ringbuffer is enabled; that doesn't work with standard output or a named pipe */
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"Ring buffer requested, but capture is being written to standard output or to a named pipe.");
g_free(capfile_name);
return FALSE;
@@ -3579,7 +3579,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
}
if (capture_opts->print_file_names) {
if (!ringbuf_set_print_name(capture_opts->print_name_to, NULL)) {
- g_snprintf(errmsg, errmsg_len, "Could not write filenames to %s: %s.\n",
+ snprintf(errmsg, errmsg_len, "Could not write filenames to %s: %s.\n",
capture_opts->print_name_to,
g_strerror(errno));
g_free(capfile_name);
@@ -3673,7 +3673,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
/* did we fail to open the output file? */
if (*save_file_fd == -1) {
if (is_tempfile) {
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"The temporary file to which the capture would be saved (\"%s\") "
"could not be opened: %s.", capfile_name, err_tempfile->message);
g_error_free(err_tempfile);
@@ -3685,7 +3685,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
ringbuf_error_cleanup();
}
- g_snprintf(errmsg, errmsg_len,
+ snprintf(errmsg, errmsg_len,
"The file to which the capture would be saved (\"%s\") "
"could not be opened: %s.", capfile_name,
g_strerror(errno));
@@ -3945,13 +3945,13 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
case INITFILTER_BAD_FILTER:
cfilter_error = TRUE;
error_index = i;
- g_snprintf(errmsg, sizeof(errmsg), "%s", pcap_geterr(pcap_src->pcap_h));
+ snprintf(errmsg, sizeof(errmsg), "%s", pcap_geterr(pcap_src->pcap_h));
goto error;
case INITFILTER_OTHER_ERROR:
- g_snprintf(errmsg, sizeof(errmsg), "Can't install filter (%s).",
+ snprintf(errmsg, sizeof(errmsg), "Can't install filter (%s).",
pcap_geterr(pcap_src->pcap_h));
- g_snprintf(secondary_errmsg, sizeof(secondary_errmsg), "%s", please_report_bug());
+ snprintf(secondary_errmsg, sizeof(secondary_errmsg), "%s", please_report_bug());
goto error;
}
}
@@ -4340,7 +4340,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
/* Let the parent process know. */
pcap_dropped += stats->ps_drop;
} else {
- g_snprintf(errmsg, sizeof(errmsg),
+ snprintf(errmsg, sizeof(errmsg),
"Can't get packet-drop statistics: %s",
pcap_geterr(pcap_src->pcap_h));
report_capture_error(errmsg, please_report_bug());
@@ -4415,44 +4415,44 @@ capture_loop_get_errmsg(char *errmsg, size_t errmsglen, char *secondary_errmsg,
switch (err) {
case ENOSPC:
- g_snprintf(errmsg, (gulong)errmsglen,
+ snprintf(errmsg, (gulong)errmsglen,
"Not all the packets could be written to the file"
" to which the capture was being saved\n"
"(\"%s\") because there is no space left on the file system\n"
"on which that file resides.",
fname);
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsglen, "%s",
+ snprintf(secondary_errmsg, (gulong)secondary_errmsglen, "%s",
find_space);
break;
#ifdef EDQUOT
case EDQUOT:
- g_snprintf(errmsg, (gulong)errmsglen,
+ snprintf(errmsg, (gulong)errmsglen,
"Not all the packets could be written to the file"
" to which the capture was being saved\n"
"(\"%s\") because you are too close to, or over,"
" your disk quota\n"
"on the file system on which that file resides.",
fname);
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsglen, "%s",
+ snprintf(secondary_errmsg, (gulong)secondary_errmsglen, "%s",
find_space);
break;
#endif
default:
if (is_close) {
- g_snprintf(errmsg, (gulong)errmsglen,
+ snprintf(errmsg, (gulong)errmsglen,
"The file to which the capture was being saved\n"
"(\"%s\") could not be closed: %s.",
fname, g_strerror(err));
} else {
- g_snprintf(errmsg, (gulong)errmsglen,
+ snprintf(errmsg, (gulong)errmsglen,
"An error occurred while writing to the file"
" to which the capture was being saved\n"
"(\"%s\"): %s.",
fname, g_strerror(err));
}
- g_snprintf(secondary_errmsg, (gulong)secondary_errmsglen,
+ snprintf(secondary_errmsg, (gulong)secondary_errmsglen,
"%s", please_report_bug());
break;
}
@@ -4671,7 +4671,7 @@ capture_loop_queue_packet_cb(u_char *pcap_src_p, const struct pcap_pkthdr *phdr,
}
/* I don't want to hold the mutex over the debug output. So the
output may be wrong */
- ws_info("Queue size is now %" G_GINT64_MODIFIER "d bytes (%" G_GINT64_MODIFIER "d packets)",
+ ws_info("Queue size is now %" PRId64 " bytes (%" PRId64 " packets)",
pcap_queue_bytes, pcap_queue_packets);
}
@@ -4728,7 +4728,7 @@ capture_loop_queue_pcapng_cb(capture_src *pcap_src, const pcapng_block_header_t
}
/* I don't want to hold the mutex over the debug output. So the
output may be wrong */
- ws_info("Queue size is now %" G_GINT64_MODIFIER "d bytes (%" G_GINT64_MODIFIER "d packets)",
+ ws_info("Queue size is now %" PRId64 " bytes (%" PRId64 " packets)",
pcap_queue_bytes, pcap_queue_packets);
}
@@ -5622,7 +5622,7 @@ report_packet_count(unsigned int packet_count)
static unsigned int count = 0;
if (capture_child) {
- g_snprintf(count_str, sizeof(count_str), "%u", packet_count);
+ snprintf(count_str, sizeof(count_str), "%u", packet_count);
ws_debug("Packets: %s", count_str);
pipe_write_block(2, SP_PACKET_COUNT, count_str);
} else {
@@ -5683,7 +5683,7 @@ report_cfilter_error(capture_options *capture_opts, guint i, const char *errmsg)
if (i < capture_opts->ifaces->len) {
if (capture_child) {
- g_snprintf(tmp, sizeof(tmp), "%u:%s", i, errmsg);
+ snprintf(tmp, sizeof(tmp), "%u:%s", i, errmsg);
ws_debug("Capture filter error: %s", errmsg);
pipe_write_block(2, SP_BAD_FILTER, tmp);
} else {