diff options
Diffstat (limited to 'src/or/tor_main.c')
-rw-r--r-- | src/or/tor_main.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/or/tor_main.c b/src/or/tor_main.c index c203d8248f..703669ac99 100644 --- a/src/or/tor_main.c +++ b/src/or/tor_main.c @@ -3,6 +3,11 @@ * Copyright (c) 2007-2017, The Tor Project, Inc. */ /* See LICENSE for licensing information */ +#include "orconfig.h" +#ifdef ENABLE_RESTART_DEBUGGING +#include <stdlib.h> +#endif + /** * \file tor_main.c * \brief Stub module containing a main() function. @@ -19,9 +24,18 @@ int tor_main(int argc, char *argv[]); int main(int argc, char *argv[]) { - int r = tor_main(argc, argv); + int r; +#ifdef ENABLE_RESTART_DEBUGGING + int restart_count = getenv("TOR_DEBUG_RESTART") ? 1 : 0; + again: +#endif + r = tor_main(argc, argv); if (r < 0 || r > 255) return 1; +#ifdef ENABLE_RESTART_DEBUGGING + else if (r == 0 && restart_count--) + goto again; +#endif else return r; } |