Date: Fri, 2 Oct 1998 15:44:29 +0200 (MET DST) From: Jean-Francois Dockes <dockes@cdkit.remcomp.fr> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/8129: libc_r write() on broken pipe returns no error Message-ID: <199810021344.PAA24308@yquem.cdkit.remcomp.fr>
index | next in thread | raw e-mail
>Number: 8129
>Category: bin
>Synopsis: libc_r write() on broken pipe, no error return.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Oct 2 07:00:00 PDT 1998
>Last-Modified:
>Originator: Jean-Francois Dockes
>Organization:
CDKIT
>Release: FreeBSD 2.2.7-RELEASE i386
>Environment:
Standard 2.2.7 RELEASE on pentium machine.
>Description:
When linking with libc_r and catching SIGPIPE, a write() call on a
pipe or socket with no reader doesn't return an error. The program
seems to be looping sending/catching SIGPIPES.
This is a real problem for a network server that talks to the client
before forking, or needs to cleanup when the client goes away.
>How-To-Repeat:
The following trivial program can be used. Pipe it to 'more' and type 'q'.
If the program was linked normally, it prints the normal error
(write: Broken pipe).
If linked with libc_r it loops forever, printing "Got sig 13".
#include <stdio.h>
#include <signal.h>
void sigshow(int sig)
{
fprintf(stderr, "Got sig %d\n", sig);
}
main()
{
struct sigaction sa;
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sa.sa_handler = sigshow;
sigaction(SIGPIPE, &sa, NULL);
for (;;) {
if (write(1, "THIS IS DATA\n", 13) != 13) {
perror("write");
exit(1);
}
}
}
>Fix:
No idea.
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810021344.PAA24308>
