diff options
author | Richard Sharpe <sharpe@ns.aus.com> | 2002-07-15 05:14:26 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@ns.aus.com> | 2002-07-15 05:14:26 +0000 |
commit | eac7bf11888e56d64ca3a07e6ca3599c4689e513 (patch) | |
tree | 38091ea7535d826ec1102e61d4386175f56c283c /file.c | |
parent | fbaa0dd8098576b6588953dda111238b4081ab16 (diff) | |
download | wireshark-eac7bf11888e56d64ca3a07e6ca3599c4689e513.tar.gz wireshark-eac7bf11888e56d64ca3a07e6ca3599c4689e513.tar.bz2 wireshark-eac7bf11888e56d64ca3a07e6ca3599c4689e513.zip |
This seems to fix the problem of trying to save over the top of an existing
capture on some occassions.
svn path=/trunk/; revision=5872
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.280 2002/06/29 09:45:06 guy Exp $ + * $Id: file.c,v 1.281 2002/07/15 05:14:26 sharpe Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1733,6 +1733,17 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered, statusbar_push_file_msg(save_msg); g_free(save_msg); + /* + * Check that the from file is not the same as to file + * We do it here so we catch all cases ... + */ + if (strcmp(cf->filename, fname) == 0) { + simple_dialog(ESD_TYPE_CRIT, NULL, + "Can't save over current capture file: %s!", + cf->filename); + goto fail; + } + if (!save_filtered && !save_marked && save_format == cf->cd_t) { /* We're not filtering packets, and we're saving it in the format it's already in, so we can just move or copy the raw data. */ @@ -1777,14 +1788,6 @@ save_cap_file(char *fname, capture_file *cf, gboolean save_filtered, } if (do_copy) { - /* Check that the from file is not the same as to file */ - if (strcmp(from_filename, fname) == 0) { - simple_dialog(ESD_TYPE_CRIT, NULL, - "Can't save over current capture file: %s!", - from_filename); - goto fail; - } - /* Copy the file, if we haven't moved it. */ if (!copy_binary_file(from_filename, fname)) goto fail; |