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:
Yukihiro "Matz" Matsumoto
2023-02-26 18:40:45 +09:00
parent d86c4a795d
commit 84a4d340a6
+1 -1
View File
@@ -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);
}