summaryrefslogtreecommitdiff
path: root/wiretap/file_wrappers.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-06-01 08:05:12 +0000
committerGuy Harris <guy@alum.mit.edu>2012-06-01 08:05:12 +0000
commit129c881fcf7c8707f379a09d2ed2cdfcc178b807 (patch)
treec3e2e1a9b39235d5b89594d3947e849d9152c09a /wiretap/file_wrappers.h
parent86c69b01e7965f37eecbe6195e797a52ab81e23e (diff)
downloadwireshark-129c881fcf7c8707f379a09d2ed2cdfcc178b807.tar.gz
Sigh. There appears to be no way to get Windows to allow us to rename a
file that we ourselves have open. In the "safe save" code path for capture files, on Windows temporarily close the file descriptors for the currently-open capture before doing the rename and then, if the rename failed, reopen them, leaving the rest of the wtap and capture_file structures intact. Rename filed_open() to file_fdopen(), to make its name match what it does a bit better (it's an fdopen()-style routine, i.e. do the equivalent of an open with an already-open file descriptor rather than a pathname, in the file_wrappers.c set of routines). Remove the file_ routines from the .def file for Wiretap - they should only be called by code inside Wiretap. Closing a descriptor open for input has no reason to fail (closing a descriptor open for *writing* could fail if the file is on a server and dirty pages are pushed asynchronously to the server and synchronously on a close), so just have file_close() return void. svn path=/trunk/; revision=42961
Diffstat (limited to 'wiretap/file_wrappers.h')
-rw-r--r--wiretap/file_wrappers.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/wiretap/file_wrappers.h b/wiretap/file_wrappers.h
index 4ef46fb297..efdb9c2950 100644
--- a/wiretap/file_wrappers.h
+++ b/wiretap/file_wrappers.h
@@ -28,7 +28,7 @@
#include <wsutil/file_util.h>
extern FILE_T file_open(const char *path);
-extern FILE_T filed_open(int fildes);
+extern FILE_T file_fdopen(int fildes);
extern void file_set_random_access(FILE_T stream, gboolean random, GPtrArray *seek);
extern gint64 file_seek(FILE_T stream, gint64 offset, int whence, int *err);
extern gint64 file_skip(FILE_T file, gint64 delta, int *err);
@@ -42,7 +42,9 @@ extern char *file_gets(char *buf, int len, FILE_T stream);
extern int file_eof(FILE_T stream);
extern int file_error(FILE_T fh, gchar **err_info);
extern void file_clearerr(FILE_T stream);
-extern int file_close(FILE_T file);
+extern void file_fdclose(FILE_T file);
+extern int file_fdreopen(FILE_T file, const char *path);
+extern void file_close(FILE_T file);
#ifdef HAVE_LIBZ
typedef struct wtap_writer *GZWFILE_T;