[tor-dev] When to exit 0 on error

Nick Mathewson nickm at alum.mit.edu
Fri Jun 23 13:29:36 UTC 2017


On Thu, Jun 22, 2017 at 10:49 PM,  <f55jwk4f at vfemail.net> wrote:
> I noticed tor sometimes exits 0 on error, specifically in
> monitor_owning_controller_process in src/or/control.c:
>
>   if (owning_controller_process_monitor == NULL) {
>     log_err(LD_BUG, "Couldn't create process-termination monitor for "
>             "owning controller: %s.  Exiting.",
>             msg);
>     owning_controller_process_spec = NULL;
>     tor_cleanup();
>     exit(0);
>   }
>
> and in try_locking in main.c:
>
>         r = try_locking(options, 0);
>         if (r<0) {
>           log_err(LD_GENERAL, "No, it's still there.  Exiting.");
>           exit(0);
>         }
>
> When to exit 0 on error?

When the error is unrecoverable, and continuing would be worse then exiting.


More information about the tor-dev mailing list