[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] When to exit 0 on error



On Sat, Jun 24, 2017 at 12:38 AM,  <f55jwk4f@xxxxxxxxxxx> wrote:
> On Fri, Jun 23, 2017 at 10:29:32AM -0400, Zack Weinberg wrote:
>> On Fri, Jun 23, 2017 at 9:29 AM, Nick Mathewson <nickm@xxxxxxxxxxxx> wrote:
>> > On Thu, Jun 22, 2017 at 10:49 PM,  <f55jwk4f@xxxxxxxxxxx> wrote:
>> >> I noticed tor sometimes exits 0 on error
>> >> [...]
>> >> When to exit 0 on error?
>> >
>> > When the error is unrecoverable, and continuing would be worse then exiting.
>>
>> I don't think the question was "when is it appropriate to _exit_ on
>> error?"  I think it was "when is it appropriate to exit _0_ (i.e.
>> apparently successfully) on error?"
>>
>> My expectation would be that exit(0) on fatal error is presumptively a
>> minor bug, it should be exit(1), and if there is some compelling
>> reason to exit successfully in a particular error case, there ought to
>> be a comment explaining that reason.
>>
>> zw
>
> Yes.  I mean why to exit success instead of failure.  But I don't know
> if those cases are typos, because there are 2 such cases, and a typo
> like that can be easily spotted in a review.
>

Ah, you're right. Those should be exit(1).

I've opened https://trac.torproject.org/projects/tor/ticket/22720 in
case anybody wants to fix this. This would be a good task for anybody
who's new to the Tor code: see doc/HACKING/GettingStarted.md for
information on getting started and writing patches.
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev