summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-04 14:38:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-04 14:38:02 +0000
commita30657e815d70c52b04d9220de30eb9b0b235909 (patch)
tree01739f4e172d5ce3a5f8b5c8184ab237d46d40c8 /file.c
parent89f49fb47794b48619d82d7b8b373ce71c9e229f (diff)
* file.c (rb_stat_s_utime): fixed a commit miss for the platforms
where utimes() does not exist. * lib/fileutils.rb (touch): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/file.c b/file.c
index fbe0c84..e392cd7 100644
--- a/file.c
+++ b/file.c
@@ -2054,12 +2054,15 @@ rb_file_s_utime(argc, argv)
rb_scan_args(argc, argv, "2*", &atime, &mtime, &rest);
- tv = rb_time_timeval(atime);
- utbuf.actime = tv.tv_sec;
- tv = rb_time_timeval(mtime);
- utbuf.modtime = tv.tv_sec;
+ if (!NIL_P(atime) || !NIL_P(mtime)) {
+ utp = &utbuf;
+ tv = rb_time_timeval(atime);
+ utp->actime = tv.tv_sec;
+ tv = rb_time_timeval(mtime);
+ utp->modtime = tv.tv_sec;
+ }
- n = apply2files(utime_internal, rest, &utbuf);
+ n = apply2files(utime_internal, rest, utp);
return LONG2FIX(n);
}