Bug 32540 - SIGPIPE not ignored causing SEGV
Summary: SIGPIPE not ignored causing SEGV
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
Depends On:
TreeView+ depends on / blocked
Reported: 2001-03-21 16:58 UTC by Martine Braham-Moses
Modified: 2016-11-24 15:25 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2002-12-15 14:30:50 UTC

Attachments (Terms of Use)

Description Martine Braham-Moses 2001-03-21 16:58:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; Computer 
Associates International v2.501a)

In my c program, that using a C-API connects to a database, I issue a 
signal(SIGPIPE, SIG_IGN); then connect to the database do nothing with the 
database and start a infinite loop. In another window I issue kill -13 pid 
and I get a SEGV and core dump.  If I ignore other signals none of them 
cause a SEGV except SIGSEGV and SIGPIPE.

Reproducible: Always
Steps to Reproduce:
1. Compile the program
2. run the program
3. issue a ps -a and get the pid
4. issue a kill -13 pid

Actual Results:  Segmentation fault (core dump).

Expected Results:  Nothing should have happened it was supposed to ignore 
the signal.

Here is the program:

#include "codqlhdr.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

#define TIME 5

int main()
    odbSessH sh;
    odbStatus rc;
    odbMMProp mmProp;
    char	*envfile = getenv("JAS_ENVFILE");
    char msg[128];
    char t;
    long msglen;
    long errorcode;

    printf("make keep sleeping for %d(s) \n",TIME);
    printf("\n======START SESSION!!======\n");
    rc = odbSesStart(&sh,NULL,NULL,NULL,NULL);

    if(rc != ODB_NORMAL) {
        printf("It was not able to connect to the Jasmine server at 
        printf("Detail information(%s).\n",msg);
    /* loop eternally */


Comment 1 Olivier Baudron 2001-03-22 18:28:33 UTC
I tried to reproduce the bug but could not compile your program without the API.
Nonetheless, I may give you 2 suggestions:
1) Move getenv() outside the declarations
2) Make sure, you include signal.h

Comment 2 Martine Braham-Moses 2001-03-26 16:14:19 UTC
I realize you would not be able to reproduce exactly without the api which I 
can't provide.  Can you try connecting to any database?  Also I did as you 
suggested and its better, just a segmentation fault without the core dump.

Comment 3 Alan Cox 2002-12-15 14:30:50 UTC
Without the "odb" this seems to work. I would assume odb is unblocking SIGPIPE
for internal use and not handling it correctly

Note You need to log in before you can comment on or make changes to this bug.