Problems with setvbuf
authorIlya Zakharevich <ilya@math.ohio-state.edu>
Thu, 7 Aug 1997 00:00:00 +0000 (00:00 +0000)
committerTim Bunce <Tim.Bunce@ig.co.uk>
Wed, 6 Aug 1997 12:00:00 +0000 (00:00 +1200)
Nick Ing-Simmons writes:
> > I see two possible solutions:
> >
> > a) correct this on the level of IO.xs (manually check for
> >         IoIFP(sv_2io(ST(0)));
>
> I like adding this code to the else branch.

This is almost as you ask:

p5p-msgid: 199707250040.UAA11000@monk.mps.ohio-state.edu

ext/IO/IO.xs

index 2eb16f4..e558d5c 100644 (file)
@@ -271,6 +271,8 @@ setvbuf(handle, buf, type, size)
     CODE:
 /* Should check HAS_SETVBUF once Configure tests for that */
 #if defined(PERLIO_IS_STDIO) && defined(_IOFBF)
+       if (!handle)                    /* Try input stream. */
+           handle = IoIFP(sv_2io(ST(0)));
        if (handle)
            RETVAL = setvbuf(handle, buf, type, size);
        else {