summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/capture_if_dlg.c4
-rw-r--r--gtk/drag_and_drop.c4
-rw-r--r--gtk/file_dlg.c4
-rw-r--r--gtk/fileset_dlg.c4
-rw-r--r--gtk/filter_dlg.h1
-rw-r--r--gtk/follow_dlg.c16
-rw-r--r--gtk/graph_analysis.c5
-rw-r--r--gtk/gui_utils.c4
-rw-r--r--gtk/help_dlg.c3
-rw-r--r--gtk/main.c11
-rw-r--r--gtk/print_dlg.c4
-rw-r--r--gtk/print_mswin.c3
-rw-r--r--gtk/proto_draw.c18
-rw-r--r--gtk/recent.c7
-rw-r--r--gtk/rtp_analysis.c149
-rw-r--r--gtk/rtp_stream.c3
-rw-r--r--gtk/text_page.c3
17 files changed, 105 insertions, 138 deletions
diff --git a/gtk/capture_if_dlg.c b/gtk/capture_if_dlg.c
index b1fa9b14ef..cfac902365 100644
--- a/gtk/capture_if_dlg.c
+++ b/gtk/capture_if_dlg.c
@@ -28,10 +28,6 @@
#ifdef HAVE_LIBPCAP
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
diff --git a/gtk/drag_and_drop.c b/gtk/drag_and_drop.c
index ca282f4422..d868de3e61 100644
--- a/gtk/drag_and_drop.c
+++ b/gtk/drag_and_drop.c
@@ -26,10 +26,6 @@
# include "config.h"
#endif
-#ifdef HAVE_IO_H
-#include <io.h> /* open/close on win32 */
-#endif
-
#ifdef HAVE_LIBPCAP
#include <pcap.h>
#endif
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index a4735722d2..3d60e7fd94 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -63,10 +63,6 @@
#include <unistd.h>
#endif
-#ifdef HAVE_IO_H
-#include <io.h> /* open/close on win32 */
-#endif
-
static void file_open_ok_cb(GtkWidget *w, gpointer fs);
static void file_open_destroy_cb(GtkWidget *win, gpointer user_data);
static void file_merge_ok_cb(GtkWidget *w, gpointer fs);
diff --git a/gtk/fileset_dlg.c b/gtk/fileset_dlg.c
index 4ee09596c3..1cb519604b 100644
--- a/gtk/fileset_dlg.c
+++ b/gtk/fileset_dlg.c
@@ -28,10 +28,6 @@
#include <string.h>
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
diff --git a/gtk/filter_dlg.h b/gtk/filter_dlg.h
index f6049c5b6c..2d1417e090 100644
--- a/gtk/filter_dlg.h
+++ b/gtk/filter_dlg.h
@@ -29,7 +29,6 @@
* "Capture Filter" / "Display Filter" / "Add expression" dialog boxes.
* (This used to be a notebook page under "Preferences", hence the
* "prefs" in the file name.)
- * @todo rename this and the corresponding .c file to filter_dlg to reflect current implementation
* @ingroup dialog_group
*/
diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c
index 8765363952..23535c1a05 100644
--- a/gtk/follow_dlg.c
+++ b/gtk/follow_dlg.c
@@ -30,9 +30,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_IO_H
-#include <io.h> /* open/close on win32 */
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -42,6 +39,7 @@
#include "isprint.h"
+#include "file_util.h"
#include "color.h"
#include "colors.h"
#include "file.h"
@@ -203,7 +201,7 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not create temporary file %s: %s",
follow_info->data_out_filename, strerror(errno));
- close(tmp_fd);
+ eth_close(tmp_fd);
unlink(follow_info->data_out_filename);
g_free(follow_info);
return;
@@ -601,7 +599,7 @@ follow_read_stream(follow_info_t *follow_info,
iplen = (follow_info->is_ipv6) ? 16 : 4;
- data_out_file = fopen(follow_info->data_out_filename, "rb");
+ data_out_file = eth_fopen(follow_info->data_out_filename, "rb");
if (data_out_file == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open temporary file %s: %s", follow_info->data_out_filename,
@@ -931,7 +929,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
print_mswin(print_dest);
/* trash temp file */
- remove(print_dest);
+ eth_remove(print_dest);
}
#endif
return;
@@ -949,7 +947,7 @@ print_error:
#ifdef _WIN32
if (win_printer) {
/* trash temp file */
- remove(print_dest);
+ eth_remove(print_dest);
}
#endif
}
@@ -1138,10 +1136,10 @@ follow_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
follow_info = OBJECT_GET_DATA(fs, E_FOLLOW_INFO_KEY);
if (follow_info->show_type == SHOW_RAW) {
/* Write the data out as raw binary data */
- fh = fopen(to_name, "wb");
+ fh = eth_fopen(to_name, "wb");
} else {
/* Write it out as text */
- fh = fopen(to_name, "w");
+ fh = eth_fopen(to_name, "w");
}
if (fh == NULL) {
open_failure_alert_box(to_name, errno, TRUE);
diff --git a/gtk/graph_analysis.c b/gtk/graph_analysis.c
index 624debaa7b..ff4716a56f 100644
--- a/gtk/graph_analysis.c
+++ b/gtk/graph_analysis.c
@@ -57,6 +57,7 @@
#include "compat_macros.h"
#include "../color.h"
#include "epan/filesystem.h"
+#include "file_util.h"
#include <string.h>
@@ -294,7 +295,7 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t* user_data)
FILE *of;
- of = fopen(user_data->dlg.save_file,"w");
+ of = eth_fopen(user_data->dlg.save_file,"w");
if (of==NULL){
return FALSE;
}
@@ -526,7 +527,7 @@ static void save_to_file_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
/* check whether the file exists */
- file_test = fopen(user_data_p->dlg.save_file,"r");
+ file_test = eth_fopen(user_data_p->dlg.save_file,"r");
if (file_test!=NULL){
dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO,
diff --git a/gtk/gui_utils.c b/gtk/gui_utils.c
index 725dcfcb08..0f927c0cd3 100644
--- a/gtk/gui_utils.c
+++ b/gtk/gui_utils.c
@@ -34,13 +34,11 @@
#include <windows.h>
#endif
-#ifdef HAVE_IO_H
-# include <io.h>
-#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include "file_util.h"
#include "gtkglobals.h"
#include "gui_utils.h"
#include <epan/prefs.h>
diff --git a/gtk/help_dlg.c b/gtk/help_dlg.c
index 3d4884afd3..464b998334 100644
--- a/gtk/help_dlg.c
+++ b/gtk/help_dlg.c
@@ -42,6 +42,7 @@
#include "dlg_utils.h"
#include "simple_dialog.h"
#include "webbrowser.h"
+#include "file_util.h"
#define HELP_DIR "help"
@@ -116,7 +117,7 @@ void help_dialog(void)
}
help_toc_file_path = get_datafile_path(HELP_DIR G_DIR_SEPARATOR_S "toc");
- help_toc_file = fopen(help_toc_file_path, "r");
+ help_toc_file = eth_fopen(help_toc_file_path, "r");
if (help_toc_file == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open file \"%s\": %s",
help_toc_file_path, strerror(errno));
diff --git a/gtk/main.c b/gtk/main.c
index 584e9292a9..67757b674c 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -39,10 +39,6 @@
#include <unistd.h>
#endif
-#ifdef HAVE_IO_H
-#include <io.h> /* open/close on win32 */
-#endif
-
#ifdef NEED_STRERROR_H
#include "strerror.h"
#endif
@@ -140,6 +136,7 @@
#include "capture_ui_utils.h"
#include "log.h"
#include "../epan/emem.h"
+#include "file_util.h"
@@ -2690,9 +2687,9 @@ create_console(void)
create one and make it the standard input, output, and error. */
if (!AllocConsole())
return; /* couldn't create console */
- freopen("CONIN$", "r", stdin);
- freopen("CONOUT$", "w", stdout);
- freopen("CONOUT$", "w", stderr);
+ eth_freopen("CONIN$", "r", stdin);
+ eth_freopen("CONOUT$", "w", stdout);
+ eth_freopen("CONOUT$", "w", stderr);
/* Well, we have a console now. */
has_console = TRUE;
diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c
index 61caec2883..0478bbc525 100644
--- a/gtk/print_dlg.c
+++ b/gtk/print_dlg.c
@@ -43,12 +43,12 @@
#include <epan/epan_dissect.h>
#include <epan/filesystem.h>
#ifdef _WIN32
-#include <io.h>
#include "print_mswin.h"
#endif
#include "compat_macros.h"
#include "range_utils.h"
#include "help_dlg.h"
+#include "file_util.h"
/* dialog output action */
@@ -988,7 +988,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
print_mswin(args->file);
/* trash temp file */
- remove(args->file);
+ eth_remove(args->file);
}
#endif
}
diff --git a/gtk/print_mswin.c b/gtk/print_mswin.c
index f61bd7c503..8e772628fa 100644
--- a/gtk/print_mswin.c
+++ b/gtk/print_mswin.c
@@ -38,6 +38,7 @@
#endif
#include "print_mswin.h"
+#include "file_util.h"
/*
Some thoughts about a GTK win32 printer dialog:
@@ -187,7 +188,7 @@ void print_file( char *file_name, HDC hdc) {
SetMapMode (hdc, MM_TEXT);
- fh1 = fopen( file_name, "r" );
+ fh1 = eth_fopen( file_name, "r" );
if( !fh1 )
perror( "open failed on input file" );
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index 8cb6bf513d..0d0c8a47f9 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -31,10 +31,6 @@
#include <ctype.h>
-#ifdef HAVE_IO_H
-#include <io.h> /* open/close on win32 */
-#endif
-
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -73,11 +69,7 @@
#include "font_utils.h"
#include "../ui_util.h"
-
-/* Win32 needs the O_BINARY flag for open() */
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
+#include "file_util.h"
#define BYTE_VIEW_WIDTH 16
#define BYTE_VIEW_SEP 8
@@ -886,17 +878,17 @@ savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_)
return;
}
- fd = open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
+ fd = eth_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
if (fd == -1) {
open_failure_alert_box(file, errno, TRUE);
return;
}
- if (write(fd, data_p + start, end - start) < 0) {
+ if (eth_write(fd, data_p + start, end - start) < 0) {
write_failure_alert_box(file, errno);
- close(fd);
+ eth_close(fd);
return;
}
- if (close(fd) < 0) {
+ if (eth_close(fd) < 0) {
write_failure_alert_box(file, errno);
return;
}
diff --git a/gtk/recent.c b/gtk/recent.c
index 85e505cdb3..7e7c09ef6d 100644
--- a/gtk/recent.c
+++ b/gtk/recent.c
@@ -43,6 +43,7 @@
#include "dlg_utils.h"
#include "cfilter_combo_utils.h"
#include "simple_dialog.h"
+#include "file_util.h"
#define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show"
#define RECENT_KEY_FILTER_TOOLBAR_SHOW "gui.filter_toolbar_show"
@@ -121,7 +122,7 @@ write_recent(void)
}
rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE);
- if ((rf = fopen(rf_path, "w")) == NULL) {
+ if ((rf = eth_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path,
strerror(errno));
@@ -522,7 +523,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */
*rf_path_return = NULL;
- if ((rf = fopen(rf_path, "r")) != NULL) {
+ if ((rf = eth_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_pair_static);
fclose(rf);
@@ -554,7 +555,7 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */
*rf_path_return = NULL;
- if ((rf = fopen(rf_path, "r")) != NULL) {
+ if ((rf = eth_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic);
/* set dfilter combobox to have an empty line */
diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c
index 4ec79d7dd5..4489869b0f 100644
--- a/gtk/rtp_analysis.c
+++ b/gtk/rtp_analysis.c
@@ -91,14 +91,7 @@
#include <fcntl.h>
#endif
-#ifdef HAVE_IO_H
-#include <io.h> /* open/close on win32 */
-#endif
-
-/* Win32 needs the O_BINARY flag for open() */
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
+#include "file_util.h"
/****************************************************************************/
@@ -477,10 +470,10 @@ rtp_reset(void *user_data_arg)
fclose(user_data->forward.saveinfo.fp);
if (user_data->reversed.saveinfo.fp != NULL)
fclose(user_data->reversed.saveinfo.fp);
- user_data->forward.saveinfo.fp = fopen(user_data->f_tempname, "wb");
+ user_data->forward.saveinfo.fp = eth_fopen(user_data->f_tempname, "wb");
if (user_data->forward.saveinfo.fp == NULL)
user_data->forward.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
- user_data->reversed.saveinfo.fp = fopen(user_data->r_tempname, "wb");
+ user_data->reversed.saveinfo.fp = eth_fopen(user_data->r_tempname, "wb");
if (user_data->reversed.saveinfo.fp == NULL)
user_data->reversed.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
return;
@@ -1006,8 +999,8 @@ static void on_destroy(GtkWidget *win _U_, user_data_t *user_data _U_)
if (user_data->reversed.saveinfo.fp != NULL)
fclose(user_data->reversed.saveinfo.fp);
/*XXX: test for error **/
- remove(user_data->f_tempname);
- remove(user_data->r_tempname);
+ eth_remove(user_data->f_tempname);
+ eth_remove(user_data->r_tempname);
/* destroy save_voice_as window if open */
if (user_data->dlg.save_voice_as_w != NULL)
@@ -2274,7 +2267,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
user_data = (user_data_t*)OBJECT_GET_DATA(bt, "user_data");
if (GTK_TOGGLE_BUTTON(forw)->active || GTK_TOGGLE_BUTTON(both)->active) {
- fp = fopen(g_dest, "w");
+ fp = eth_fopen(g_dest, "w");
if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE);
return;
@@ -2328,7 +2321,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
if (GTK_TOGGLE_BUTTON(rev)->active || GTK_TOGGLE_BUTTON(both)->active) {
if (GTK_TOGGLE_BUTTON(both)->active) {
- fp = fopen(g_dest, "a");
+ fp = eth_fopen(g_dest, "a");
if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE);
return;
@@ -2340,7 +2333,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
return;
}
} else {
- fp = fopen(g_dest, "w");
+ fp = eth_fopen(g_dest, "w");
if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE);
return;
@@ -2503,20 +2496,20 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
guint32 progbar_count, progbar_quantum, progbar_nextstep = 0, count = 0;
gboolean stop_flag = FALSE;
- forw_fd = open(user_data->f_tempname, O_RDONLY | O_BINARY);
+ forw_fd = eth_open(user_data->f_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (forw_fd < 0)
return FALSE;
- rev_fd = open(user_data->r_tempname, O_RDONLY | O_BINARY);
+ rev_fd = eth_open(user_data->r_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (rev_fd < 0) {
- close(forw_fd);
+ eth_close(forw_fd);
return FALSE;
}
/* open file for saving */
- to_fd = open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
+ to_fd = eth_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (to_fd < 0) {
- close(forw_fd);
- close(rev_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
return FALSE;
}
@@ -2526,35 +2519,35 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
{
/* First we write the .au header. XXX Hope this is endian independant */
/* the magic word 0x2e736e64 == .snd */
- *pd = (unsigned char)0x2e; write(to_fd, pd, 1);
- *pd = (unsigned char)0x73; write(to_fd, pd, 1);
- *pd = (unsigned char)0x6e; write(to_fd, pd, 1);
- *pd = (unsigned char)0x64; write(to_fd, pd, 1);
+ *pd = (unsigned char)0x2e; eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x73; eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x6e; eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x64; eth_write(to_fd, pd, 1);
/* header offset == 24 bytes */
- *pd = (unsigned char)0x00; write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- *pd = (unsigned char)0x18; write(to_fd, pd, 1);
+ *pd = (unsigned char)0x00; eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x18; eth_write(to_fd, pd, 1);
/* total length, it is permited to set this to 0xffffffff */
- *pd = (unsigned char)0xff; write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- write(to_fd, pd, 1);
+ *pd = (unsigned char)0xff; eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
/* encoding format == 8 bit ulaw */
- *pd = (unsigned char)0x00; write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- *pd = (unsigned char)0x01; write(to_fd, pd, 1);
+ *pd = (unsigned char)0x00; eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x01; eth_write(to_fd, pd, 1);
/* sample rate == 8000 Hz */
- *pd = (unsigned char)0x00; write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- *pd = (unsigned char)0x1f; write(to_fd, pd, 1);
- *pd = (unsigned char)0x40; write(to_fd, pd, 1);
+ *pd = (unsigned char)0x00; eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x1f; eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x40; eth_write(to_fd, pd, 1);
/* channels == 1 */
- *pd = (unsigned char)0x00; write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- write(to_fd, pd, 1);
- *pd = (unsigned char)0x01; write(to_fd, pd, 1);
+ *pd = (unsigned char)0x00; eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ eth_write(to_fd, pd, 1);
+ *pd = (unsigned char)0x01; eth_write(to_fd, pd, 1);
switch (channels) {
@@ -2580,18 +2573,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
*pd = (unsigned char)linear2ulaw(tmp);
}
else{
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
- fwritten = write(to_fd, pd, 1);
+ fwritten = eth_write(to_fd, pd, 1);
if ((fwritten < fread) || (fwritten < 0) || (fread < 0)) {
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
@@ -2620,18 +2613,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
*pd = (unsigned char)linear2ulaw(tmp);
}
else{
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
- rwritten = write(to_fd, pd, 1);
+ rwritten = eth_write(to_fd, pd, 1);
if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
@@ -2707,19 +2700,19 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
}
else
{
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
- rwritten = write(to_fd, pd, 1);
+ rwritten = eth_write(to_fd, pd, 1);
if ((rwritten < 0) || (rread < 0) || (fread < 0)) {
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
@@ -2746,9 +2739,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
break;
}
default: {
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
@@ -2767,12 +2760,12 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
}
count++;
- rwritten = write(to_fd, pd, 1);
+ rwritten = eth_write(to_fd, pd, 1);
if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
destroy_progress_dlg(progbar);
return FALSE;
}
@@ -2780,9 +2773,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
}
destroy_progress_dlg(progbar);
- close(forw_fd);
- close(rev_fd);
- close(to_fd);
+ eth_close(forw_fd);
+ eth_close(rev_fd);
+ eth_close(to_fd);
return TRUE;
}
@@ -3687,10 +3680,10 @@ void rtp_analysis(
/*XXX: check for errors*/
fd = create_tempfile(user_data->f_tempname, sizeof(user_data->f_tempname),
"ether_rtp_f");
- close(fd);
+ eth_close(fd);
fd = create_tempfile(user_data->r_tempname, sizeof(user_data->r_tempname),
"ether_rtp_r");
- close(fd);
+ eth_close(fd);
user_data->forward.saveinfo.fp = NULL;
user_data->reversed.saveinfo.fp = NULL;
user_data->dlg.save_voice_as_w = NULL;
diff --git a/gtk/rtp_stream.c b/gtk/rtp_stream.c
index 7d93a3b1a1..75b82fc65f 100644
--- a/gtk/rtp_stream.c
+++ b/gtk/rtp_stream.c
@@ -41,6 +41,7 @@
#include "alert_box.h"
#include "simple_dialog.h"
+#include "file_util.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@@ -337,7 +338,7 @@ gboolean rtpstream_save(rtp_stream_info_t* stream, const gchar *filename)
{
gboolean was_registered = the_tapinfo_struct.is_registered;
/* open file for saving */
- the_tapinfo_struct.save_file = fopen(filename, "wb");
+ the_tapinfo_struct.save_file = eth_fopen(filename, "wb");
if (the_tapinfo_struct.save_file==NULL) {
open_failure_alert_box(filename, errno, TRUE);
return FALSE;
diff --git a/gtk/text_page.c b/gtk/text_page.c
index eb4d415682..a51c8a10d8 100644
--- a/gtk/text_page.c
+++ b/gtk/text_page.c
@@ -38,6 +38,7 @@
#include "compat_macros.h"
#include "simple_dialog.h"
#include "font_utils.h"
+#include "file_util.h"
#define TEXT_KEY "txt_key"
@@ -129,7 +130,7 @@ static void text_page_set_text(GtkWidget *page, const char *absolute_path)
gtk_text_freeze(txt);
#endif
- text_file = fopen(absolute_path, "r");
+ text_file = eth_fopen(absolute_path, "r");
if (text_file != NULL) {
while (fgets(line, sizeof line, text_file) != NULL) {
text_page_insert(page, line, strlen(line));