* io.c (io_close): call rb_io_close() directly if io is a T_FILE

object.  [ruby-dev:27156]

* file.c (file_expand_path): allow pathnames to expand.
  [ruby-dev:27152]

* numeric.c (Init_Numeric): should define Fixnum#div.
  [ruby-dev:27129]

* file.c (rb_thread_flock): wrap flock(2) by TRAP_BEG and
  TRAP_END.  [ruby-dev:27122]

* file.c (rb_file_join): call FilePathValue() to all Pathnames to
  join.  [ruby-dev:27127]

* file.c (rb_get_path): call StringValueCStr() to ensure no nul
  bytes in path strings.

* gc.c (garbage_collect): need value for return.  [ruby-dev:27127]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-09-19 16:01:06 +00:00
parent 5363e91dba
commit 7559d2fd7a
6 changed files with 56 additions and 7 deletions

15
file.c
View file

@ -88,7 +88,8 @@ rb_get_path(VALUE obj)
if (rb_respond_to(obj, to_path)) {
obj = rb_funcall(obj, to_path, 0, 0);
}
tmp = rb_str_to_str(obj);
tmp = obj;
StringValueCStr(tmp);
exit:
if (obj != tmp) {
rb_check_safe_obj(tmp);
@ -2271,6 +2272,7 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
long buflen, dirlen;
int tainted;
FilePathValue(fname);
s = StringValuePtr(fname);
BUFINIT();
tainted = OBJ_TAINTED(fname);
@ -2737,7 +2739,7 @@ rb_file_join(VALUE ary, VALUE sep)
}
break;
default:
tmp = rb_obj_as_string(tmp);
FilePathValue(tmp);
}
name = StringValueCStr(result);
if (i > 0 && !NIL_P(sep)) {
@ -2884,11 +2886,20 @@ static int
rb_thread_flock(int fd, int op, OpenFile *fptr)
{
if (rb_thread_alone() || (op & LOCK_NB)) {
<<<<<<< file.c
int n;
TRAP_BEG;
n = flock(fd, op);
TRAP_END;
return n;
=======
int ret;
TRAP_BEG;
ret = flock(fd, op);
TRAP_END;
return ret;
>>>>>>> 1.208
}
op |= LOCK_NB;
while (flock(fd, op) < 0) {