From 67983abe66fe8ec3b463950bc12a32c019bd32d7 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 17 Sep 2000 07:58:39 +0000 Subject: [PATCH] The correct way to check for an error (rather than an EOF) from a failed attempt to read from a capture file is to check whether the error returned was 0 - if it is, it's an EOF. We no longer guarantee that the data offset supplied will be negative on an error and 0 on an EOF. svn path=/trunk/; revision=2445 --- file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/file.c b/file.c index 28b9878cb0..ed804bc606 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.221 2000/09/12 03:28:34 guy Exp $ + * $Id: file.c,v 1.222 2000/09/17 07:58:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -387,7 +387,7 @@ read_cap_file(capture_file *cf, int *err) if (cf->first_displayed != NULL) gtk_signal_emit_by_name(GTK_OBJECT(packet_list), "select_row", 0); - if (data_offset < 0) { + if (*err != 0) { /* Put up a message box noting that the read failed somewhere along the line. Don't throw out the stuff we managed to read, though, if any. */ @@ -492,7 +492,7 @@ continue_tail_cap_file(capture_file *cf, int to_read, int *err) "finish_tail_cap_file()" will be called, and it will clean up and exit. */ return READ_ABORTED; - } else if (data_offset < 0) { + } else if (*err != 0) { /* We got an error reading the capture file. XXX - pop up a dialog box? */ return (READ_ERROR); @@ -561,7 +561,7 @@ finish_tail_cap_file(capture_file *cf, int *err) set_menus_for_capture_file(TRUE); set_menus_for_unsaved_capture_file(!cf->user_saved); - if (data_offset < 0) { + if (*err != 0) { /* We got an error reading the capture file. XXX - pop up a dialog box? */ return (READ_ERROR);