aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/file.c b/file.c
index 735602a8e3..4350c3702d 100644
--- a/file.c
+++ b/file.c
@@ -74,7 +74,7 @@
#include <epan/dissectors/packet-ber.h>
#include <epan/timestamp.h>
#include <epan/dfilter/dfilter-macro.h>
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include <epan/column-utils.h>
#include <epan/strutil.h>
#include <epan/emem.h>
@@ -327,7 +327,7 @@ cf_reset_state(capture_file *cf)
if (cf->filename != NULL) {
/* If it's a temporary file, remove it. */
if (cf->is_tempfile)
- eth_unlink(cf->filename);
+ ws_unlink(cf->filename);
g_free(cf->filename);
cf->filename = NULL;
}
@@ -1037,7 +1037,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
fdata->col_expr.col_expr = cf->cinfo.col_expr.col_expr;
fdata->col_expr.col_expr_val = cf->cinfo.col_expr.col_expr_val;
-
+
row = packet_list_append(cf->cinfo.col_data, fdata);
/* colorize packet: first apply color filters
@@ -1178,7 +1178,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
if (*out_filenamep != NULL) {
out_filename = *out_filenamep;
- out_fd = eth_open(out_filename, O_CREAT|O_TRUNC|O_BINARY, 0600);
+ out_fd = ws_open(out_filename, O_CREAT|O_TRUNC|O_BINARY, 0600);
if (out_fd == -1)
open_err = errno;
} else {
@@ -1201,7 +1201,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
merge_max_snapshot_length(in_file_count, in_files),
FALSE /* compressed */, &open_err);
if (pdh == NULL) {
- eth_close(out_fd);
+ ws_close(out_fd);
merge_close_in_files(in_file_count, in_files);
g_free(in_files);
cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE,
@@ -2236,7 +2236,7 @@ cf_write_pdml_packets(capture_file *cf, print_args_t *print_args)
FILE *fh;
psp_return_t ret;
- fh = eth_fopen(print_args->file, "w");
+ fh = ws_fopen(print_args->file, "w");
if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@@ -2310,7 +2310,7 @@ cf_write_psml_packets(capture_file *cf, print_args_t *print_args)
FILE *fh;
psp_return_t ret;
- fh = eth_fopen(print_args->file, "w");
+ fh = ws_fopen(print_args->file, "w");
if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@@ -2384,7 +2384,7 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
FILE *fh;
psp_return_t ret;
- fh = eth_fopen(print_args->file, "w");
+ fh = ws_fopen(print_args->file, "w");
if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@@ -2430,7 +2430,7 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
static gboolean
write_carrays_packet(capture_file *cf _U_, frame_data *fdata,
- union wtap_pseudo_header *pseudo_header _U_,
+ union wtap_pseudo_header *pseudo_header _U_,
const guint8 *pd, void *argsp)
{
FILE *fh = argsp;
@@ -2445,7 +2445,7 @@ cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
FILE *fh;
psp_return_t ret;
- fh = eth_fopen(print_args->file, "w");
+ fh = ws_fopen(print_args->file, "w");
if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@@ -2459,7 +2459,7 @@ cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
/* Iterate through the list of packets, printing the packets we were
told to print. */
- ret = process_specified_packets(cf, &print_args->range,
+ ret = process_specified_packets(cf, &print_args->range,
"Writing C Arrays",
"selected packets", TRUE,
write_carrays_packet, fh);
@@ -3499,7 +3499,7 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
capture, so it doesn't need to stay around under that name;
first, try renaming the capture buffer file to the new name. */
#ifndef _WIN32
- if (eth_rename(cf->filename, fname) == 0) {
+ if (ws_rename(cf->filename, fname) == 0) {
/* That succeeded - there's no need to copy the source file. */
from_filename = NULL;
do_copy = FALSE;
@@ -3928,7 +3928,7 @@ copy_binary_file(const char *from_filename, const char *to_filename)
guint8 pd[65536];
/* Copy the raw bytes of the file. */
- from_fd = eth_open(from_filename, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
+ from_fd = ws_open(from_filename, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (from_fd < 0) {
open_failure_alert_box(from_filename, errno, FALSE);
goto done;
@@ -3939,23 +3939,23 @@ copy_binary_file(const char *from_filename, const char *to_filename)
may open the file in text mode, not binary mode, but we want
to copy the raw bytes of the file, so we need the output file
to be open in binary mode. */
- to_fd = eth_open(to_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
+ to_fd = ws_open(to_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (to_fd < 0) {
open_failure_alert_box(to_filename, errno, TRUE);
- eth_close(from_fd);
+ ws_close(from_fd);
goto done;
}
- while ((nread = eth_read(from_fd, pd, sizeof pd)) > 0) {
- nwritten = eth_write(to_fd, pd, nread);
+ while ((nread = ws_read(from_fd, pd, sizeof pd)) > 0) {
+ nwritten = ws_write(to_fd, pd, nread);
if (nwritten < nread) {
if (nwritten < 0)
err = errno;
else
err = WTAP_ERR_SHORT_WRITE;
write_failure_alert_box(to_filename, err);
- eth_close(from_fd);
- eth_close(to_fd);
+ ws_close(from_fd);
+ ws_close(to_fd);
goto done;
}
}
@@ -3964,12 +3964,12 @@ copy_binary_file(const char *from_filename, const char *to_filename)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"An error occurred while reading from the file \"%s\": %s.",
from_filename, strerror(err));
- eth_close(from_fd);
- eth_close(to_fd);
+ ws_close(from_fd);
+ ws_close(to_fd);
goto done;
}
- eth_close(from_fd);
- if (eth_close(to_fd) < 0) {
+ ws_close(from_fd);
+ if (ws_close(to_fd) < 0) {
write_failure_alert_box(to_filename, errno);
goto done;
}