summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-08 13:52:51 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-08 13:52:51 +0000
commitb6d5ce7975667cc32d7d86a992d5206627e5ff73 (patch)
tree1802023dc4f9a29204373e917d10d24d4b68d186 /ext/zlib
parent5b06e833453dcbbf4da69a5f98d50e565d4300ef (diff)
* ext/zlib/zlib.c (rb_gzfile_close): Don't raise on double
close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/zlib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 8f24b77..9c2b7b6 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -3297,9 +3297,13 @@ rb_gzfile_set_comment(VALUE obj, VALUE str)
static VALUE
rb_gzfile_close(VALUE obj)
{
- struct gzfile *gz = get_gzfile(obj);
+ struct gzfile *gz;
VALUE io;
+ TypedData_Get_Struct(obj, struct gzfile, &gzfile_data_type, gz);
+ if (!ZSTREAM_IS_READY(&gz->z)) {
+ return Qnil;
+ }
io = gz->io;
gzfile_close(gz, 1);
return io;