aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-08-08 10:28:58 +0200
committerMartin Willi <martin@revosec.ch>2014-08-08 16:36:00 +0200
commit508f90131a3277d94ef1a30f4524bd6c9b59d8cf (patch)
tree6e1016556808cae02e5e76e481269ea30b19deaa
parentf51c923f69f921b8888aff7cd3ab29fc6aea6ab8 (diff)
downloadstrongswan-508f90131a3277d94ef1a30f4524bd6c9b59d8cf.tar.bz2
strongswan-508f90131a3277d94ef1a30f4524bd6c9b59d8cf.tar.xz
starter: Wait indefinitely for charon when using --attach-gdb
This makes sure the user has time to set break points etc. before it runs charon under gdb.
-rw-r--r--src/starter/invokecharon.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/starter/invokecharon.c b/src/starter/invokecharon.c
index d40ab8c28..5d95305cb 100644
--- a/src/starter/invokecharon.c
+++ b/src/starter/invokecharon.c
@@ -201,10 +201,14 @@ int starter_start_charon (starter_config_t *cfg, bool no_fork, bool attach_gdb)
default:
/* father */
_charon_pid = pid;
- if (attach_gdb)
+ while (attach_gdb)
{
- /* don't monitor pid file if gdb is attached */
- return 0;
+ /* wait indefinitely if gdb is attached */
+ usleep(10000);
+ if (stat(pid_file, &stb) == 0)
+ {
+ return 0;
+ }
}
for (i = 0; i < 500 && _charon_pid; i++)
{