This is the mail archive of the glibc-bugs@sources.redhat.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]
Other format: [Raw text]

[Bug libc/713] New: fgets() should only return zero upon error or EOF


/*
 * fgets() should only return zero upon error or EOF
 * (and not having enough space to store all available
 * input is not an error).
 *
 * For example under Fedora Core release 3 ...
 *    % gcc -static c.c -o c
 *    % echo | ./c
 *    ERROR
 *
 * whereas under Solaris 5.8 ...
 *    % gcc -static c.c -o c
 *    % echo | ./c
 *    OK
 */

#include <stdio.h>

int
main()
{
    char buf[1];
    char *bp;

    bp = fgets(buf, sizeof buf, stdin);
    printf("%s\n", (bp == buf) ? "OK" : "ERROR");
    return 0;
}

-- 
           Summary: fgets() should only return zero upon error or EOF
           Product: glibc
           Version: 2.3.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: bww at acm dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=713

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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