From 94184f1065b44d94c207ee75105695de5edc2fd9 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 14 Jul 2006 15:16:12 +0200 Subject: don't die on SIGPIPE if gs has a problem (reported by A Mennucc) --- src/GsWidget.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx index 5741be6..eeefd90 100644 --- a/src/GsWidget.cxx +++ b/src/GsWidget.cxx @@ -272,23 +272,30 @@ GsWidget::load_page(int p) { int GsWidget::fd_copy(int to, int from, size_t len) { size_t n, r; char buf[1024]; + int ret = 0; + + signal(SIGPIPE, SIG_IGN); // don't die if gs has a problem n = 0; while(len > 0) { - Fl::check(); // let fltk do its stuff - otherwise - // gs can't get the GHOSTVIEW property + + Fl::check(); // let fltk do its stuff + r = read(from, buf, MIN(sizeof(buf), len)); if (r < 0) { perror("read"); - return 1; + ret = 1; + break; } write(to, buf, r); len -= r; } - return 0; + signal(SIGPIPE, SIG_DFL); + + return ret; } void GsWidget::exec_gs() { -- cgit v1.2.3