summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-06 16:26:05 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-06 16:26:05 +0000
commitc7144179bbd4a8349bee677e2d9c89b1df52f445 (patch)
treed7ef2d1952c1bed2ffa1f24978aca1da1ce6e90d /io.c
parentbf4626ed723a122c43a9edf73d68873ed4ca56d5 (diff)
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 6 insertions, 4 deletions
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);