From owner-freebsd-bugs Fri Oct 2 07:00:07 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA00511 for freebsd-bugs-outgoing; Fri, 2 Oct 1998 07:00:07 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA00501 for ; Fri, 2 Oct 1998 07:00:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id HAA03632; Fri, 2 Oct 1998 07:00:01 -0700 (PDT) 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 ; 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 Reply-To: dockes@cdkit.remcomp.fr To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/8129: libc_r write() on broken pipe returns no error Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 #include 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