From: Adam Dickmeiss Date: Wed, 10 Dec 2014 10:35:35 +0000 (+0100) Subject: backtrace: show error if pipe fails YAZ-805 X-Git-Tag: v5.7.2~8 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=dd37dbb261ac22f4d12bae1ec70236f51763051f;p=yaz-moved-to-github.git backtrace: show error if pipe fails YAZ-805 --- diff --git a/src/backtrace.c b/src/backtrace.c index 76e890f..6bc22bf 100644 --- a/src/backtrace.c +++ b/src/backtrace.c @@ -54,11 +54,16 @@ static void yaz_invoke_backtrace(char *buf, int buf_sz) sz = backtrace(backtrace_info, sz); backtrace_symbols_fd(backtrace_info, sz, fd); - pipe(fds); + if (pipe(fds) == -1) + { + const char *cp = "backtrace: pipe failed\n"; + write(fd, cp, strlen(cp)); + return; + } pid = fork(); if (pid == (pid_t) (-1)) { /* error */ - const char *cp = "backtrace: fork failure"; + const char *cp = "backtrace: fork failure\n"; write(fd, cp, strlen(cp)); } else if (pid == 0)