Permalink
Browse files

* ext/writev/writev.c: check for array type. Fixes #2

* test/test_writev.rb: appropriate test
  • Loading branch information...
tenderlove committed Oct 12, 2012
1 parent 2bca786 commit 962e35e6595d30bc3e6b24c06cfc78313efbf8a4
Showing with 15 additions and 0 deletions.
  1. +5 −0 CHANGELOG.rdoc
  2. +1 −0 ext/writev/writev.c
  3. +9 −0 test/test_writev.rb
View
@@ -1,3 +1,8 @@
+Thu Oct 11 18:43:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/writev/writev.c: check for array type. Fixes #2
+ * test/test_writev.rb: appropriate test
+
=== 1.0.1 / 2011-08-19
* 1 bug fixed
View
@@ -20,6 +20,7 @@ static VALUE rb_writev(VALUE io, VALUE list)
ssize_t written;
VALUE tmp;
+ Check_Type(list, T_ARRAY);
#ifdef IOV_MAX
if(RARRAY_LEN(list) > IOV_MAX)
#else
View
@@ -11,6 +11,15 @@ def test_writev
file.unlink
end
+ def test_checks_arguments
+ file = Tempfile.new('foo')
+
+ assert_raises TypeError do
+ file.writev('hello')
+ end
+ file.unlink
+ end
+
def test_length
file = Tempfile.new('foo')

0 comments on commit 962e35e

Please sign in to comment.