From 4d4482016368614b2187727489d7508dbdc94309 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 18 Sep 2023 16:48:26 +0100 Subject: util/nvmutil: don't use err_if on argc check at this stage in the code, the file name will be NULL value, so it would be improper to use it in a string. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 290808d3..55d7e5f6 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -73,7 +73,8 @@ void (*cmd)(void) = NULL; int main(int argc, char *argv[]) { - err_if((errno = argc < 3 ? EINVAL : errno)); + if (argc < 3) + err(errno = ECANCELED, "Too few arguments"); flags = (strcmp(COMMAND, "dump") == 0) ? O_RDONLY : flags; filename = argv[1]; #ifdef __OpenBSD__ -- cgit v1.2.1