summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-19 16:01:06 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-19 16:01:06 +0000
commit7559d2fd7accfd9eab2c8ab5864a5c61d6016d1d (patch)
treee5b382e3e6dc23c0eef00a2da9fb50c0e2281495 /file.c
parent5363e91dba3d2bd1dffaf8eeff53bc3f0a2a3ce4 (diff)
* 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
Diffstat (limited to 'file.c')
-rw-r--r--file.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/file.c b/file.c
index 6302bb8935..d4a993be2a 100644
--- a/file.c
+++ b/file.c
@@ -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) {