Skip to content

Commit 0bd50e9

Browse files
author
glass
committed
file.c: raise NotImplementedError instread of Errno::ENOSYS
[Misc #15615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 56557ec commit 0bd50e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

file.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,12 +1198,22 @@ rb_statx(VALUE file, struct statx *stx, unsigned int mask)
11981198

11991199
# define statx_has_birthtime(st) ((st)->stx_mask & STATX_BTIME)
12001200

1201+
/* rb_notimplement() shows "function is unimplemented on this machine".
1202+
It is not applicable to statx which behavior depends on the filesystem. */
1203+
static void
1204+
statx_notimplement(const char *field_name)
1205+
{
1206+
rb_raise(rb_eNotImpError,
1207+
"%s is unimplemented on this filesystem",
1208+
field_name);
1209+
}
1210+
12011211
static VALUE
12021212
statx_birthtime(const struct statx *stx, VALUE fname)
12031213
{
12041214
if (!statx_has_birthtime(stx)) {
12051215
/* birthtime is not supported on the filesystem */
1206-
rb_syserr_fail_path(ENOSYS, fname);
1216+
statx_notimplement("birthtime");
12071217
}
12081218
return rb_time_nano_new(stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec);
12091219
}

0 commit comments

Comments
 (0)