NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/45112: cgdconfig can return -1 from main
>Number: 45112
>Category: bin
>Synopsis: cgdconfig can return -1 from main
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jul 03 19:10:00 +0000 2011
>Originator: David A. Holland
>Release: current of 20110703
>Organization:
>Environment:
n/a
>Description:
The end of main() directly returns the return value of various
operation functions, some of which can return -1 on error. However,
just as one should not call exit(-1), one should not return -1 from
main.
Some of these functions may return errnos as well, which doesn't
seem like a good idea to mix with ordinary 0/1 exit codes.
This issue was actually noted by jruoho in chat.
>How-To-Repeat:
code reading
>Fix:
At the bottom of main, check for -1 and return 2 instead? Also, if
there's some real reason to return errnos, perhaps offset them by
16 or something... also, if so these exit codes should be
documented, which they aren't.
Home |
Main Index |
Thread Index |
Old Index