public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/713] New: fgets() should only return zero upon error or EOF
@ 2005-02-10 21:04 bww at acm dot org
  2005-03-02 17:59 ` [Bug libc/713] " ballen at gravity dot phys dot uwm dot edu
  2005-09-27  0:00 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: bww at acm dot org @ 2005-02-10 21:04 UTC (permalink / raw)
  To: glibc-bugs

/*
 * 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/713] fgets() should only return zero upon error or EOF
  2005-02-10 21:04 [Bug libc/713] New: fgets() should only return zero upon error or EOF bww at acm dot org
@ 2005-03-02 17:59 ` ballen at gravity dot phys dot uwm dot edu
  2005-09-27  0:00 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ballen at gravity dot phys dot uwm dot edu @ 2005-03-02 17:59 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ballen at gravity dot phys dot uwm dot edu  2005-03-02 17:59 -------
I am seeing some odd behavior on FC3 that might be related.  I have a cgi program, which uses fgets() 
to read from stdin.  In this case, stdin is a pipe to Apache, which is connected to a socket from the 
remote machine.  fgets() is NOT returning (it hangs), but when I call feof(stdin) I get EOF.

Bruce Allen

-- 


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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/713] fgets() should only return zero upon error or EOF
  2005-02-10 21:04 [Bug libc/713] New: fgets() should only return zero upon error or EOF bww at acm dot org
  2005-03-02 17:59 ` [Bug libc/713] " ballen at gravity dot phys dot uwm dot edu
@ 2005-09-27  0:00 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2005-09-27  0:00 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-09-27 00:00 -------
This is just a problem for the special case n==1 which does not do any reading
at all.  Fixed in CVS trunk.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-27  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-10 21:04 [Bug libc/713] New: fgets() should only return zero upon error or EOF bww at acm dot org
2005-03-02 17:59 ` [Bug libc/713] " ballen at gravity dot phys dot uwm dot edu
2005-09-27  0:00 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).