From 8a435355135daf19040fcc6b02e6570d918958fd Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 29 Jan 2025 04:10:52 +0000 Subject: [PATCH] util/nvmutil: Fix bad comparison We're checking if errno is ENOTDIR, not setting it; the previous code would always return true, and then set errno 0, which in the context of this code was actually OK, so this patch makes no functional difference in practise. However, I'm a stickler for technical correctness. I caught this when trying to compile with clang, because clang is quite pedantic about checking for exactly this type of bug. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b8319a0d..b016e419 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -182,7 +182,7 @@ checkdir(const char *path) { if (opendir(path) != NULL) err(errno = EISDIR, "%s", path); - if (errno = ENOTDIR) + if (errno == ENOTDIR) errno = 0; err_if(errno); }