From: Eric Wong Date: 2017-07-13T20:54:24+00:00 Subject: [ruby-core:82037] Re: [Ruby trunk Feature#13743] Support linking of files opened with O_TMPFILE glass.saga@gmail.com wrote: > Feature #13743: Support linking of files opened with O_TMPFILE > https://bugs.ruby-lang.org/issues/13743 I like this feature. > patch.diff (2.44 KB) > + if (!NIL_P(tmp) && from_fptr && from_fptr->fd >= 0) { /* when 'from' is an IO and opened */ > + char from_path[PATH_MAX]; > + > + rb_io_flush(from); > + FilePathValue(to); > + to = rb_str_encode_ospath(to); > + snprintf(from_path, PATH_MAX, "/proc/self/fd/%d", from_fptr->fd); However, PATH_MAX (4096 on Linux) is excessive use of stack. Since fd is an int, we can safely set a smaller size. Also, I'm not sure why rb_io_flush needs to be called, here. Thanks. Unsubscribe: