Have "cf_merge_files()" always close "out_fd" before returning; it does
so if "wtap_dump_fdopen()" succeeds (as a side-effect of calling "wtap_dump_close()"), even if "cf_merge_fails()" after that, so it should do so if it fails. That means we don't need to close it in the callers of "cf_merge_files()". svn path=/trunk/; revision=13407
This commit is contained in:
parent
1aa4357464
commit
ea7ef54b0d
1
file.c
1
file.c
|
@ -981,6 +981,7 @@ cf_merge_files(const char *out_filename, int out_fd, int in_file_count,
|
||||||
merge_select_frame_type(in_file_count, in_files),
|
merge_select_frame_type(in_file_count, in_files),
|
||||||
merge_max_snapshot_length(in_file_count, in_files), &open_err);
|
merge_max_snapshot_length(in_file_count, in_files), &open_err);
|
||||||
if (pdh == NULL) {
|
if (pdh == NULL) {
|
||||||
|
close(out_fd);
|
||||||
merge_close_in_files(in_file_count, in_files);
|
merge_close_in_files(in_file_count, in_files);
|
||||||
free(in_files);
|
free(in_files);
|
||||||
cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE,
|
cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE,
|
||||||
|
|
|
@ -148,7 +148,6 @@ dnd_merge_files(int in_file_count, char **in_filenames)
|
||||||
|
|
||||||
if (!merge_ok) {
|
if (!merge_ok) {
|
||||||
/* merge failed */
|
/* merge failed */
|
||||||
close(out_fd); /* XXX - isn't it already closed? */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,12 +239,13 @@ dnd_open_file_cmd(GtkSelectionData *selection_data)
|
||||||
break;
|
break;
|
||||||
case(1):
|
case(1):
|
||||||
/* open and read the capture file (this will close an existing file) */
|
/* open and read the capture file (this will close an existing file) */
|
||||||
if (cf_open(&cfile, in_filenames[0], FALSE, &err) == CF_OK) {
|
if (cf_open(&cfile, in_filenames[0], FALSE, &err) == CF_OK) {
|
||||||
cf_read(&cfile);
|
/* XXX - add this to the menu if the read fails? */
|
||||||
add_menu_recent_capture_file(in_filenames[0]);
|
cf_read(&cfile);
|
||||||
} else {
|
add_menu_recent_capture_file(in_filenames[0]);
|
||||||
/* the capture file couldn't be read (doesn't exist, file format unknown, ...) */
|
} else {
|
||||||
}
|
/* the capture file couldn't be read (doesn't exist, file format unknown, ...) */
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* build and show the info dialog */
|
/* build and show the info dialog */
|
||||||
|
|
|
@ -1057,7 +1057,6 @@ file_merge_ok_cb(GtkWidget *w, gpointer fs) {
|
||||||
g_free(cf_name);
|
g_free(cf_name);
|
||||||
|
|
||||||
if (merge_status != CF_OK) {
|
if (merge_status != CF_OK) {
|
||||||
close(out_fd); /* XXX - it's already closed, right? */
|
|
||||||
if (rfcode != NULL)
|
if (rfcode != NULL)
|
||||||
dfilter_free(rfcode);
|
dfilter_free(rfcode);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue