summaryrefslogtreecommitdiff
path: root/src/GsWidget.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-07-14 15:16:12 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-07-14 15:16:12 +0200
commit94184f1065b44d94c207ee75105695de5edc2fd9 (patch)
tree18fd506e25161345b1f20aef7f1ca8235f0e9a80 /src/GsWidget.cxx
parentfe0a190ad3463c10a888284e0880ffabaa2942a7 (diff)
don't die on SIGPIPE if gs has a problem (reported by A Mennucc)
Diffstat (limited to 'src/GsWidget.cxx')
-rw-r--r--src/GsWidget.cxx15
1 files changed, 11 insertions, 4 deletions
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() {