diff options
| author | Leah Rowe <leah@libreboot.org> | 2025-01-24 18:14:25 +0000 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2025-01-24 18:14:25 +0000 | 
| commit | ec3148dc3b5d4fd392ef9cbfe31051e54503768e (patch) | |
| tree | e4575f5b34abbb58480d87e449eb189b0fc35d0e | |
| parent | 073420d30563407f336e28e3df4eacd020e838b5 (diff) | |
util/nvmutil: Show specific error for bad cmd argc
For example, if the brick command is used without specifying
a part number. Instead of saying "Invalid argument", show a
much more useful error message to help the user adapt.
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index c3d242d8..c2839c45 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -130,8 +130,11 @@ main(int argc, char *argv[])  	for (int i = 0; (i < 6) && (cmd == NULL); i++) {  		if (strcmp(COMMAND, op[i].str) != 0)  			continue; -		if (argc >= op[i].args) +		if (argc >= op[i].args) {  			cmd = op[i].cmd; +			break; +		} +		err(errno = EINVAL, "Too few args on command '%s'", op[i].str);  	}  	if (cmd == cmd_setmac) { | 
