File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
#include "cache.h"
2
+ #include "sigchain.h"
2
3
#include "trace2/tr2_dst.h"
3
4
#include "trace2/tr2_sid.h"
4
5
#include "trace2/tr2_sysenv.h"
@@ -360,6 +361,7 @@ int tr2_dst_trace_want(struct tr2_dst *dst)
360
361
void tr2_dst_write_line (struct tr2_dst * dst , struct strbuf * buf_line )
361
362
{
362
363
int fd = tr2_dst_get_trace_fd (dst );
364
+ ssize_t bytes ;
363
365
364
366
strbuf_complete_line (buf_line ); /* ensure final NL on buffer */
365
367
@@ -378,12 +380,15 @@ void tr2_dst_write_line(struct tr2_dst *dst, struct strbuf *buf_line)
378
380
*
379
381
* If we get an IO error, just close the trace dst.
380
382
*/
381
- if (write (fd , buf_line -> buf , buf_line -> len ) >= 0 )
383
+ sigchain_push (SIGPIPE , SIG_IGN );
384
+ bytes = write (fd , buf_line -> buf , buf_line -> len );
385
+ sigchain_pop (SIGPIPE );
386
+ if (bytes >= 0 )
382
387
return ;
383
388
389
+ tr2_dst_trace_disable (dst );
384
390
if (tr2_dst_want_warning ())
385
391
warning ("unable to write trace to '%s': %s" ,
386
392
tr2_sysenv_display_name (dst -> sysenv_var ),
387
393
strerror (errno ));
388
- tr2_dst_trace_disable (dst );
389
394
}
You can’t perform that action at this time.
0 commit comments