aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-12-15 23:26:12 +0100
committerChristian Grothoff <christian@grothoff.org>2019-12-15 23:26:12 +0100
commit4446d990f39b4b39a2988c49faac4d1f8a71e31f (patch)
tree0b6eebb5baa45d857848fb03246fdb79cb2edecf
parent70755b10ad3f01cfdf469deaa0799553d462db7d (diff)
downloadgnunet-4446d990f39b4b39a2988c49faac4d1f8a71e31f.tar.gz
gnunet-4446d990f39b4b39a2988c49faac4d1f8a71e31f.zip
fix sigpipe crash
-rw-r--r--src/util/gnunet-qr.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c
index be28a6e53..cdeea4db1 100644
--- a/src/util/gnunet-qr.c
+++ b/src/util/gnunet-qr.c
@@ -30,7 +30,7 @@
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31 31
32#define LOG(fmt, ...) \ 32#define LOG(fmt, ...) \
33 if (verbose == true) \ 33 if (verbose) \
34 printf (fmt, ## __VA_ARGS__) 34 printf (fmt, ## __VA_ARGS__)
35 35
36/** 36/**
@@ -41,7 +41,7 @@ static char *device = "/dev/video0";
41/** 41/**
42 * --verbose option 42 * --verbose option
43 */ 43 */
44static int verbose = false; 44static unsigned int verbose;
45 45
46/** 46/**
47 * --silent option 47 * --silent option
@@ -79,6 +79,11 @@ maint_child_death (void *cls)
79 if ((GNUNET_OK != GNUNET_OS_process_status (p, &type, &exit_code)) || 79 if ((GNUNET_OK != GNUNET_OS_process_status (p, &type, &exit_code)) ||
80 (type != GNUNET_OS_PROCESS_EXITED)) 80 (type != GNUNET_OS_PROCESS_EXITED))
81 GNUNET_break (0 == GNUNET_OS_process_kill (p, GNUNET_TERM_SIG)); 81 GNUNET_break (0 == GNUNET_OS_process_kill (p, GNUNET_TERM_SIG));
82 if (NULL != sigpipe)
83 {
84 GNUNET_DISK_pipe_close (sigpipe);
85 sigpipe = NULL;
86 }
82 GNUNET_OS_process_destroy (p); 87 GNUNET_OS_process_destroy (p);
83} 88}
84 89
@@ -126,6 +131,11 @@ gnunet_uri (void *cls,
126 return; 131 return;
127 } 132 }
128 GNUNET_free (subsystem); 133 GNUNET_free (subsystem);
134 sigpipe = GNUNET_DISK_pipe (GNUNET_NO,
135 GNUNET_NO,
136 GNUNET_NO,
137 GNUNET_NO);
138 GNUNET_assert (NULL != sigpipe);
129 rt = GNUNET_SCHEDULER_add_read_file ( 139 rt = GNUNET_SCHEDULER_add_read_file (
130 GNUNET_TIME_UNIT_FOREVER_REL, 140 GNUNET_TIME_UNIT_FOREVER_REL,
131 GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ), 141 GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ),