From: Martin Willi Date: Fri, 8 Aug 2014 08:28:58 +0000 (+0200) Subject: starter: Wait indefinitely for charon when using --attach-gdb X-Git-Tag: 5.2.1dr1~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=508f90131a3277d94ef1a30f4524bd6c9b59d8cf;p=thirdparty%2Fstrongswan.git 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. --- diff --git a/src/starter/invokecharon.c b/src/starter/invokecharon.c index d40ab8c283..5d95305cb2 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++) {