From e10e1c9b0ae20ee550efb32b220239d35a00d1ac Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Tue, 9 May 2023 14:05:21 -0600 Subject: [PATCH] LU-16998 lnet: Error when missing discover arg Print an error when a user does not supply a NID argument to the 'lnetctl discover' command. Test-Parameters: trivial HPE-bug-id: LUS-11487 Signed-off-by: Chris Horn Change-Id: I081137db5490547a69248b7d2e7f7986b6d8612e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51790 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: Cyril Bordage Reviewed-by: Oleg Drokin --- lnet/utils/lnetctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lnet/utils/lnetctl.c b/lnet/utils/lnetctl.c index 9eb8ecc..b5d9d16 100644 --- a/lnet/utils/lnetctl.c +++ b/lnet/utils/lnetctl.c @@ -3481,6 +3481,11 @@ static int jt_discover(int argc, char **argv) } } + if (optind == argc) { + printf("Missing nid argument\n"); + return -1; + } + for (; optind < argc; optind++) rc = lustre_lnet_discover_nid(argv[optind], force, -1, &show_rc, &err_rc); -- 1.8.3.1