This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Various] libc/1616: core dump after changing buffer using setvbuf


Andreas Jaeger <aj@suse.de> writes:

|> >>>>> Andreas Schwab writes:
|> 
|>  > Andreas Jaeger <aj@suse.de> writes:
|>  > |> Hi glibc folks,
|>  > |> 
|>  > |> we've received the appended bug report together with a patch that
|>  > |> should fix the problem.
|>  > |> 
|>  > |> Could somebody please check whether the fix is correct?  Ulrich told
|>  > |> me privatly that he thinks the problem should be elsewhere.
|> 
|>  > That's correct.
|> 
|>  > \begin{quote}[C9x-draft, 7.19.5.6]
|>  >        [#2] The setvbuf function may be used only after the  stream
|>  >        pointed  to  by stream has been associated with an open file
|>  >        and before any other operation (other than  an  unsuccessful
|>  >        call  to  setvbuf) is performed on the stream.
|>  > \end{quote}
|> 
|>  > The program invokes undefined behaviour.
|> 
|> Thanks.  In this case the man page is wrong since it states[1]:
|> 
|>        The  setvbuf  function may be used at any time on any open
|>        stream to change its buffer.  The mode parameter  must  be
|>        one of the following three macros:
|> 
|> We should also document this in our manual.  Andreas, can you provide
|> a patch.

The manual is already correct:

    @node Controlling Buffering
    @subsection Controlling Which Kind of Buffering

    After opening a stream (but before any other operations have been
    performed on it), you can explicitly specify what kind of buffering you
    want it to have using the @code{setvbuf} function.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]