merges r30526 and r30527 from trunk into ruby_1_9_2.

--
	* io.c (rb_f_syscall): Some syscall return unsigned or pointer value.
	  Therefore we should only check the result is -1 or not. [ruby-core:34062]
--
	* io.c (rb_f_syscall): Add warning messages. [ruby-core:34062]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2011-01-16 12:35:15 +00:00
parent 62941003a2
commit 54d8811ce6
3 changed files with 16 additions and 2 deletions

7
io.c
View file

@ -7562,6 +7562,10 @@ rb_f_syscall(int argc, VALUE *argv)
int num, retval = -1;
#endif
int i;
if (RTEST(ruby_verbose)) {
rb_warning("We plan to remove a syscall function at future release. DL(Fiddle) provides safer alternative.");
}
rb_secure(2);
if (argc == 0)
@ -7635,7 +7639,8 @@ rb_f_syscall(int argc, VALUE *argv)
#endif
}
if (retval < 0) rb_sys_fail(0);
if (retval == -1)
rb_sys_fail(0);
return RETVAL2NUM(retval);
#undef SYSCALL
#undef NUM2SYSCALLID