aboutsummaryrefslogtreecommitdiffstats
path: root/editcap.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2009-06-02 17:22:40 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2009-06-02 17:22:40 +0000
commitfa71489b83975379cf77751d9d8718d8ac2e31be (patch)
tree94fbc310e8a4d2d9b7aef47c2fef735d5db0bdb1 /editcap.c
parent7e6d072ce79222cf25e7750a7a980d8cbd070de5 (diff)
Only call wtap_dump_close() if we have an open file.
We can have a situation where a file only contains a valid file header without any packages, so this will avoid a crash. svn path=/trunk/; revision=28602
Diffstat (limited to 'editcap.c')
-rw-r--r--editcap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editcap.c b/editcap.c
index d5ad41f97a..48d6f82004 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1250,9 +1250,9 @@ main(int argc, char *argv[])
}
}
- if (!wtap_dump_close(pdh, &err)) {
+ if (pdh && !wtap_dump_close(pdh, &err)) {
- fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,
+ fprintf(stderr, "editcap: Error closing %s: %s\n", filename,
wtap_strerror(err));
exit(2);