summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2022-11-07 16:49:13 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-07 09:22:41 +0000
commit3c32038a5fd72f538923bf235d3f819d9fdb3f58 (patch)
tree4e5219af4ccfd5cca96e7b9ff3bfc6626cbb2f99
parentbc22ef125b60243fdd8214ab2c3edae186cb36ca (diff)
downloadchrome-ec-3c32038a5fd72f538923bf235d3f819d9fdb3f58.tar.gz
gsctool: fix misleading error message
The getopt_long() library function returns '?' (decimal 63) in case there is a command line parameter with required value, but there is no value in the command line. gsctool is printing "could not find long opt table index for 63" in this case, which is misleading. This patch changes error message to make sense. BUG=none TEST=before this change running './gsctool -D -R' results in "could not find long opt table index for 63" after this change error message is "Command line error, parameter argument missing" Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I5b1a8fda62a7edd673ea1181efb73108677b77d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4010704 Reviewed-by: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit fdc477a9858fd7880d0988d82953833a9ddc2713) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4084742 Commit-Queue: Victor Ding <victording@chromium.org> Auto-Submit: Sam McNally <sammc@chromium.org> Commit-Queue: Sam McNally <sammc@chromium.org> Tested-by: Sam McNally <sammc@chromium.org> Reviewed-by: Victor Ding <victording@chromium.org>
-rw-r--r--extra/usb_updater/gsctool.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 8826b13917..24efaeb747 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -3436,8 +3436,7 @@ static int get_longindex(int short_opt, const struct option *long_opts)
* We could never come here as the short options list is compiled
* based on long options table.
*/
- fprintf(stderr, "could not find long opt table index for %d\n",
- short_opt);
+ fprintf(stderr, "Command line error, parameter argument missing\n");
exit(1);
return -1; /* Not reached. */