From c7144179bbd4a8349bee677e2d9c89b1df52f445 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 6 Jun 2008 16:26:05 +0000 Subject: * io.c (rb_open_file, rb_io_s_sysopen): fmode should be unsigned int. fixed [ruby-dev:34979] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 88979332ef..625766be6a 100644 --- a/io.c +++ b/io.c @@ -4017,7 +4017,8 @@ rb_open_file(int argc, VALUE *argv, VALUE io) { VALUE fname, vmode, perm; const char *mode; - int flags, fmode; + int flags; + unsigned int fmode; rb_scan_args(argc, argv, "12", &fname, &vmode, &perm); FilePathValue(fname); @@ -4030,7 +4031,7 @@ rb_open_file(int argc, VALUE *argv, VALUE io) SafeStringValue(vmode); flags = rb_io_mode_modenum(StringValueCStr(vmode)); } - fmode = NIL_P(perm) ? 0666 : NUM2INT(perm); + fmode = NIL_P(perm) ? 0666 : NUM2UINT(perm); rb_file_sysopen_internal(io, RSTRING_PTR(fname), flags, fmode); } @@ -4082,7 +4083,8 @@ static VALUE rb_io_s_sysopen(int argc, VALUE *argv) { VALUE fname, vmode, perm; - int flags, fmode, fd; + int flags, fd; + unsigned int fmode; char *path; rb_scan_args(argc, argv, "12", &fname, &vmode, &perm); @@ -4095,7 +4097,7 @@ rb_io_s_sysopen(int argc, VALUE *argv) flags = rb_io_mode_modenum(StringValueCStr(vmode)); } if (NIL_P(perm)) fmode = 0666; - else fmode = NUM2INT(perm); + else fmode = NUM2UINT(perm); RB_GC_GUARD(fname) = rb_str_new4(fname); path = RSTRING_PTR(fname); -- cgit v1.2.3