From 129c881fcf7c8707f379a09d2ed2cdfcc178b807 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 1 Jun 2012 08:05:12 +0000 Subject: 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 --- wiretap/file_access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wiretap/file_access.c') diff --git a/wiretap/file_access.c b/wiretap/file_access.c index b6525f07e8..6e88b69d96 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -317,7 +317,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info, return NULL; } #endif - if (!(wth->fh = filed_open(fd))) { + if (!(wth->fh = file_fdopen(fd))) { *err = errno; ws_close(fd); g_free(wth); -- cgit v1.2.3