From cdkit.remcomp.fr!dockes@remcomp.fr  Fri Oct  2 06:51:32 1998
Received: from doughnut.remcomp.fr (doughnut.remcomp.fr [194.51.30.251])
          by hub.freebsd.org (8.8.8/8.8.8) with SMTP id GAA29145
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 2 Oct 1998 06:51:29 -0700 (PDT)
          (envelope-from cdkit.remcomp.fr!dockes@remcomp.fr)
Received: (from dockes@localhost)
	by yquem.cdkit.remcomp.fr (8.8.5/8.8.5) id PAA24308;
	Fri, 2 Oct 1998 15:44:29 +0200 (MET DST)
Message-Id: <199810021344.PAA24308@yquem.cdkit.remcomp.fr>
Date: Fri, 2 Oct 1998 15:44:29 +0200 (MET DST)
From: Jean-Francois Dockes <dockes@cdkit.remcomp.fr>
Reply-To: dockes@cdkit.remcomp.fr
To: FreeBSD-gnats-submit@freebsd.org
Subject: libc_r write() on broken pipe returns no error
X-Send-Pr-Version: 3.2

>Number:         8129
>Category:       bin
>Synopsis:       libc_r write() on broken pipe, no error return.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct  2 07:00:00 PDT 1998
>Closed-Date:    Fri Dec 11 12:21:19 PST 1998
>Last-Modified:  Fri Dec 11 12:21:39 PST 1998
>Originator:     Jean-Francois Dockes
>Release:        FreeBSD 2.2.7-RELEASE i386
>Organization:
CDKIT
>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.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Fri Dec 11 12:21:19 PST 1998 
State-Changed-Why:  
Confirmed fixed by originator. 
>Unformatted:
