Skip to content

Commit ce25054

Browse files
committed
Merge branch 'jb/filter-ignore-sigpipe'
* jb/filter-ignore-sigpipe: Ignore SIGPIPE when running a filter driver
2 parents 2b34e48 + 6424c2a commit ce25054

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

convert.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "attr.h"
33
#include "run-command.h"
44
#include "quote.h"
5+
#include "sigchain.h"
56

67
/*
78
* convert.c - convert a file when checking it out and checking it in.
@@ -360,12 +361,16 @@ static int filter_buffer(int in, int out, void *data)
360361
if (start_command(&child_process))
361362
return error("cannot fork to run external filter %s", params->cmd);
362363

364+
sigchain_push(SIGPIPE, SIG_IGN);
365+
363366
write_err = (write_in_full(child_process.in, params->src, params->size) < 0);
364367
if (close(child_process.in))
365368
write_err = 1;
366369
if (write_err)
367370
error("cannot feed the input to external filter %s", params->cmd);
368371

372+
sigchain_pop(SIGPIPE);
373+
369374
status = finish_command(&child_process);
370375
if (status)
371376
error("external filter %s failed %d", params->cmd, status);

0 commit comments

Comments
 (0)