client: Fix exit codes for /help and similar option
authorOndrej Holy <oholy@redhat.com>
Thu, 21 Jan 2021 13:21:09 +0000 (14:21 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Thu, 25 Feb 2021 08:51:41 +0000 (09:51 +0100)
commitcf3ba7567300224409dcc0c42592d42d6636404c
tree2b8343fc8a310ff3fd94c77d2d51bd004f692a42
parent4d409b7c4bfd8b4d020fd3fdaadb71326105a8a7
client: Fix exit codes for /help and similar option

Currently, non-zero exit code is returned for /version, /buildconfig, /help,
/monitor-list, /kbd-list and /kbd-lang-list command-line options for several
clients. This is against conventions because 0 is usually returned in
such cases. Also, there is potentially another problem that the returned
codes overflow on UNIX systems (where the exit code is a number between 0
and 255). Let's fix the clients to return 0 in the mentioned cases to honor
conventions and 1 for the command-line parsing errors (or -1 for clients
who already use that value).

Fixes: https://github.com/FreeRDP/FreeRDP/issues/6686
(cherry picked from commit 3ee4cabcfad3a9ccc3c59be21245b57c17e7ae75)
client/Sample/tf_freerdp.c
client/Wayland/wlfreerdp.c
client/Windows/cli/wfreerdp.c
client/X11/cli/xfreerdp.c
winpr/include/winpr/cmdline.h