In toke.c, in the part of code that sets the file descriptor for __DATA__,
there is this chunk of code :

#if defined(HAS_FCNTL) && defined(F_SETFD)
                {
                    const int fd = PerlIO_fileno(PL_rsfp);
                    fcntl(fd,F_SETFD,fd >= 3);
                }
#endif

The 3rd argument to fcntl() puzzles me.
It's supposed to be a sum of flags, not a boolean value. Thus it
doesn't look portable at all.

On Linux and BSD it looks like this code tries to set O_WRONLY on
the __DATA__ filehandle, which is obviously wrong (and won't
succeed anyway.) My fcntl(2) manpage says :
    On Linux this command can only change the  O_APPEND,  O_ASYNC,
    O_DIRECT, O_NOATIME, and O_NONBLOCK flags.

What's the sensible thing to do ?

Reply via email to