From 2709ace096b8448f07537f978863ad061cc3c7da Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sat, 3 Dec 2022 18:08:55 -0500 Subject: [PATCH] ztest: comparisons against errno should not assign to it 888914486e26d81c8dbfd7a9d8091c05f9fc98ba introduced this regression. I used cscope to verify that there are no other instances of this in the codebase. This is the one of the few bugs that are extremely easy to identify using cscope. Reviewed-by: Damian Szuberski Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Signed-off-by: Richard Yao Closes #14264 --- cmd/ztest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index 1c7c74c5d..605ce5cea 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -1133,14 +1133,14 @@ process_options(int argc, char **argv) const char *invalid_what = "ztest"; char *val = zo->zo_alt_ztest; if (0 != access(val, X_OK) || - (strrchr(val, '/') == NULL && (errno = EINVAL))) + (strrchr(val, '/') == NULL && (errno == EINVAL))) goto invalid; int dirlen = strrchr(val, '/') - val; strlcpy(zo->zo_alt_libpath, val, MIN(sizeof (zo->zo_alt_libpath), dirlen + 1)); invalid_what = "library path", val = zo->zo_alt_libpath; - if (strrchr(val, '/') == NULL && (errno = EINVAL)) + if (strrchr(val, '/') == NULL && (errno == EINVAL)) goto invalid; *strrchr(val, '/') = '\0'; strlcat(val, "/lib", sizeof (zo->zo_alt_libpath));