aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-08-15 22:57:31 +0200
committerChristian Grothoff <christian@grothoff.org>2018-08-15 22:57:31 +0200
commitb727497bdeb0487328d470db23ea8cd6e8fdd809 (patch)
tree8c368f802ce61c68f544881f3462f41150a7d54b /src/util
parente698f8e64e283d967cc22deb575b9c70fcd14fdc (diff)
downloadgnunet-b727497bdeb0487328d470db23ea8cd6e8fdd809.tar.gz
gnunet-b727497bdeb0487328d470db23ea8cd6e8fdd809.zip
tolerate failure to start gnunet-service-resolver, make resolver not crash if /etc/resolv.conf does not exist
Diffstat (limited to 'src/util')
-rw-r--r--src/util/gnunet-service-resolver.c2
-rw-r--r--src/util/test_os_start_process.c17
2 files changed, 17 insertions, 2 deletions
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index e9397e085..90ed746b6 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -1077,11 +1077,13 @@ init_cb (void *cls,
1077 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, 1077 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
1078 cls); 1078 cls);
1079 dnsstub_ctx = GNUNET_DNSSTUB_start (128); 1079 dnsstub_ctx = GNUNET_DNSSTUB_start (128);
1080 dns_servers = NULL;
1080 num_dns_servers = lookup_dns_servers (&dns_servers); 1081 num_dns_servers = lookup_dns_servers (&dns_servers);
1081 if (0 >= num_dns_servers) 1082 if (0 >= num_dns_servers)
1082 { 1083 {
1083 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1084 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1084 _("No DNS server available. DNS resolution will not be possible.\n")); 1085 _("No DNS server available. DNS resolution will not be possible.\n"));
1086 return;
1085 } 1087 }
1086 for (int i = 0; i < num_dns_servers; i++) 1088 for (int i = 0; i < num_dns_servers; i++)
1087 { 1089 {
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c
index cfc39e1e0..1d87f2ab3 100644
--- a/src/util/test_os_start_process.c
+++ b/src/util/test_os_start_process.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -217,6 +217,12 @@ check_kill ()
217 fn, 217 fn,
218 "gnunet-service-resolver", "-", 218 "gnunet-service-resolver", "-",
219 NULL); 219 NULL);
220 if (NULL == proc)
221 {
222 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
223 "Failed to launch gnunet-service-resolver. Is your system setup correct?\n");
224 return 77;
225 }
220 sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ 226 sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */
221 GNUNET_free (fn); 227 GNUNET_free (fn);
222 if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG)) 228 if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
@@ -250,7 +256,14 @@ check_instant_kill ()
250 hello_pipe_stdin, hello_pipe_stdout, NULL, 256 hello_pipe_stdin, hello_pipe_stdout, NULL,
251 fn, 257 fn,
252 "gnunet-service-resolver", "-", NULL); 258 "gnunet-service-resolver", "-", NULL);
253 if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG)) 259 if (NULL == proc)
260 {
261 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
262 "Failed to launch gnunet-service-resolver. Is your system setup correct?\n");
263 return 77;
264 }
265 if (0 != GNUNET_OS_process_kill (proc,
266 GNUNET_TERM_SIG))
254 { 267 {
255 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 268 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
256 } 269 }