mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-io/file.c (_mtime): return nil instead of false
As a Ruby convention, a method should return nil (not false) for the exceptional value, e.g. String#index. File#_mtime should follow the convention too.
This commit is contained in:
@@ -398,7 +398,7 @@ mrb_file_mtime(mrb_state *mrb, mrb_value self)
|
||||
mrb_stat st;
|
||||
|
||||
if (mrb_fstat(fd, &st) == -1)
|
||||
return mrb_false_value();
|
||||
return mrb_nil_value();
|
||||
return mrb_int_value(mrb, (mrb_int)st.st_mtime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user