Package: dietlibc-dev
Version: 0.29-8
Severity: normal

fflush(NULL) seems to flush the stdin stream, as well as any open
streams it can find, regardless of whether or not it's a writeable
stream.   According to the fflush manpage, this is wrong:

        If  the  stream  argument  is  NULL,  fflush()  flushes all open
        output streams.

You can see this behavior with the test program I've included below, and
then test it again by commenting out the fflush(NULL) call in it to see
the difference.

#include <stdio.h>
#include <string.h>

int main (void)
{
        char buf[4096];
        while (fgets(buf,4096,stdin)) {
                /* this can also be fwrite/fprintf: */
                write(1,buf,strlen(buf));
                
                /* you can comment this out to compare */
                fflush(NULL);
        }

        return 0;
}

/* EOF */

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14.2-g54f4bf28
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)

dietlibc-dev depends on no packages.

Versions of packages dietlibc-dev recommends:
pn  dietlibc                      <none>     (no description available)

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to