Permalink
Browse files
fix for gzip closing issue
- Loading branch information...
Showing
with
12 additions
and
4 deletions.
-
+12
−4
pat.h
|
|
@@ -590,13 +590,21 @@ class CFilePatternSource : public TrimmingPatternSource { |
|
|
|
|
|
virtual ~CFilePatternSource() {
|
|
|
if(is_open_) {
|
|
|
- assert(fp_ != NULL);
|
|
|
- fclose(fp_);
|
|
|
- fp_ = NULL;
|
|
|
- if(qfp_ != NULL) {
|
|
|
+ if (compressed_) {
|
|
|
+ gzclose(zfp_);
|
|
|
+ zfp_ = NULL;
|
|
|
+ }
|
|
|
+ else if (fp_ != stdin) {
|
|
|
+ fclose(fp_);
|
|
|
+ fp_ = NULL;
|
|
|
+ }
|
|
|
+ if(qfp_ != NULL && qfp_ != stdin) {
|
|
|
fclose(qfp_);
|
|
|
qfp_ = NULL;
|
|
|
}
|
|
|
+ assert(zfp_ == NULL);
|
|
|
+ assert(fp_ == NULL || fp_ == stdin);
|
|
|
+ assert(qfp_ == NULL || qfp_ == stdin);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
0 comments on commit
6bd6623