diff options
author | Richard Yao <[email protected]> | 2022-12-03 18:08:55 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-12-08 14:15:04 -0800 |
commit | 2709ace096b8448f07537f978863ad061cc3c7da (patch) | |
tree | 75392e8f135abc1084ac6993c40f5cf2188d3159 /cmd/ztest.c | |
parent | ba87ed14103dd4b5e2cd40c347c4a653950ced16 (diff) |
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 <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14264
Diffstat (limited to 'cmd/ztest.c')
-rw-r--r-- | cmd/ztest.c | 4 |
1 files 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)); |