[前][次][番号順一覧][スレッド一覧]

ruby-changes:55131

From: glass <ko1@a...>
Date: Sat, 23 Mar 2019 19:41:23 +0900 (JST)
Subject: [ruby-changes:55131] glass:r67338 (trunk): file.c: raise NotImplementedError instread of Errno::ENOSYS

glass	2019-03-23 19:41:16 +0900 (Sat, 23 Mar 2019)

  New Revision: 67338

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67338

  Log:
    file.c: raise NotImplementedError instread of Errno::ENOSYS
    
    [Misc #15615]

  Modified files:
    trunk/file.c
Index: file.c
===================================================================
--- file.c	(revision 67337)
+++ file.c	(revision 67338)
@@ -1198,12 +1198,22 @@ rb_statx(VALUE file, struct statx *stx, https://github.com/ruby/ruby/blob/trunk/file.c#L1198
 
 # define statx_has_birthtime(st) ((st)->stx_mask & STATX_BTIME)
 
+/* rb_notimplement() shows "function is unimplemented on this machine".
+   It is not applicable to statx which behavior depends on the filesystem. */
+static void
+statx_notimplement(const char *field_name)
+{
+    rb_raise(rb_eNotImpError,
+             "%s is unimplemented on this filesystem",
+             field_name);
+}
+
 static VALUE
 statx_birthtime(const struct statx *stx, VALUE fname)
 {
     if (!statx_has_birthtime(stx)) {
         /* birthtime is not supported on the filesystem */
-        rb_syserr_fail_path(ENOSYS, fname);
+        statx_notimplement("birthtime");
     }
     return rb_time_nano_new(stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec);
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]