From dd37dbb261ac22f4d12bae1ec70236f51763051f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 10 Dec 2014 11:35:35 +0100 Subject: [PATCH] backtrace: show error if pipe fails YAZ-805 --- src/backtrace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) -- 1.7.10.4