From fdc477a9858fd7880d0988d82953833a9ddc2713 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Mon, 7 Nov 2022 16:49:13 -0800 Subject: 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 Change-Id: I5b1a8fda62a7edd673ea1181efb73108677b77d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4010704 Reviewed-by: Mary Ruthven --- extra/usb_updater/gsctool.c | 3 +-- 1 file changed, 1 insertion(+), 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. */ -- cgit v1.2.1