]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme: Return 0 on success and 1 on error
authorDaniel Wagner <dwagner@suse.de>
Fri, 28 Jan 2022 13:35:50 +0000 (14:35 +0100)
committerDaniel Wagner <dwagner@suse.de>
Fri, 28 Jan 2022 18:04:41 +0000 (19:04 +0100)
commit13f74d20e1d9e571368b1d06fe9889a2fdd29849
treeba7f9439f452695d5cbb81a9b33e9ba6a7c3c8e3
parent72ba8bc0effec2c4f3e307504225df3918599917
nvme: Return 0 on success and 1 on error

main() should return 0 on success and 1 on error. Generally there are
not fixed rules. Though SUSv3 specifies EXIT_SUCCESS(0) and
EXIT_FAILURE(1).

The main reason why we should avoid anything but 0/1 is the shell
interpretes those return codes. Values above 128 can cause confusion
in shell scripts. When a command is terminated by a signal, the
shell indicates this fact by setting the value of the variable $?
to 128 plus the signal number.

See also
  https://stackoverflow.com/questions/1101957/are-there-any-standard-exit-status-codes-in-linux
  https://tldp.org/LDP/abs/html/exitcodes.html

Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme.c