зеркало из https://github.com/github/ruby.git
* io.c (rb_ioctl): don't expose our sanity check value to ruby script.
It may change string value meaning if the value is string. (e.g. MacOS X has F_GETPATH ioctl) * io.c (rb_fcntl): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7e2f0491ce
Коммит
b3027d5929
|
@ -1,3 +1,10 @@
|
|||
Sat Nov 12 11:13:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* io.c (rb_ioctl): don't expose our sanity check value to ruby script.
|
||||
It may change string value meaning if the value is string.
|
||||
(e.g. MacOS X has F_GETPATH ioctl)
|
||||
* io.c (rb_fcntl): ditto.
|
||||
|
||||
Sat Nov 12 11:06:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* io.c (ioctl_req_t): Type of req argument of ioctl() depend on platform.
|
||||
|
|
8
io.c
8
io.c
|
@ -7973,8 +7973,10 @@ rb_ioctl(VALUE io, VALUE req, VALUE arg)
|
|||
GetOpenFile(io, fptr);
|
||||
retval = do_ioctl(fptr->fd, cmd, narg);
|
||||
if (retval < 0) rb_sys_fail_path(fptr->pathv);
|
||||
if (RB_TYPE_P(arg, T_STRING) && RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] != 17) {
|
||||
if (RB_TYPE_P(arg, T_STRING)) {
|
||||
if (RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] != 17)
|
||||
rb_raise(rb_eArgError, "return value overflowed string");
|
||||
RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] = '\0';
|
||||
}
|
||||
|
||||
return INT2NUM(retval);
|
||||
|
@ -8053,8 +8055,10 @@ rb_fcntl(VALUE io, VALUE req, VALUE arg)
|
|||
GetOpenFile(io, fptr);
|
||||
retval = do_fcntl(fptr->fd, cmd, narg);
|
||||
if (retval < 0) rb_sys_fail_path(fptr->pathv);
|
||||
if (RB_TYPE_P(arg, T_STRING) && RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] != 17) {
|
||||
if (RB_TYPE_P(arg, T_STRING)) {
|
||||
if (RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] != 17)
|
||||
rb_raise(rb_eArgError, "return value overflowed string");
|
||||
RSTRING_PTR(arg)[RSTRING_LEN(arg)-1] = '\0';
|
||||
}
|
||||
|
||||
if (cmd == F_SETFL) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче