]> diplodocus.org Git - nmh/commit
test/getcanon.c: exit(3) with 0 or 1, not -1 or symbolic error code.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 9 Sep 2017 21:45:54 +0000 (22:45 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 9 Sep 2017 21:45:54 +0000 (22:45 +0100)
commit99817f2e4d0ceaf8d3be1410c0c29fcd070ac6ec
tree79c4d936b4e56efae65bf432547cd82a85db02e3
parent9d325068a8deee98493dd44eb62a3b66b4951462
test/getcanon.c: exit(3) with 0 or 1, not -1 or symbolic error code.

gethostname(3) returns -1 on failure and that was being returned from
main;  use 1 instead.  getaddrinfo(3) returns EAI_ADDRFAMILY et al on
failure, but here they're defined as small negative integers, unsuitable
for main()'s return value;  again, use 1 instead.  Along the way, flip
the logic so the end is nigh when possible, avoiding the cognitive
overhead of tracking state when continuing to read through the source.
test/getcanon.c