diff options
author | Rose <83477269+AtariDreams@users.noreply.github.com> | 2023-05-08 23:08:18 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2023-05-23 01:16:29 +0000 |
commit | 5a9c724847f9b4e3831aa2c16276cc2ae20a99cc (patch) | |
tree | 7870808c04b895074c1bf16b71ade24765603e35 | |
parent | cef256558752afa1f25afd7823bb01fde8bd63bd (diff) | |
download | src-5a9c724847f9b4e3831aa2c16276cc2ae20a99cc.tar.gz src-5a9c724847f9b4e3831aa2c16276cc2ae20a99cc.zip |
Correct size parameter to strncmp
The wrong value passed to strncmp meant that only enable and disable were being
accepted. This change corrects the logic so enabled and disabled are also
accepted.
Pull Request: https://github.com/freebsd/freebsd-src/pull/739
MFC after: 1 week
Reviewed by: delphij, ngie
-rw-r--r-- | usr.sbin/mptutil/mpt_volume.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/mptutil/mpt_volume.c b/usr.sbin/mptutil/mpt_volume.c index 9c160542f51c..04f69bcdf929 100644 --- a/usr.sbin/mptutil/mpt_volume.c +++ b/usr.sbin/mptutil/mpt_volume.c @@ -246,9 +246,9 @@ volume_cache(int ac, char **av) Settings = volume->VolumeSettings.Settings; NewSettings = Settings; - if (strncmp(av[2], "enable", sizeof("enable")) == 0) + if (strncmp(av[2], "enable", strlen("enable")) == 0) NewSettings |= 0x01; - if (strncmp(av[2], "disable", sizeof("disable")) == 0) + else if (strncmp(av[2], "disable", strlen("disable")) == 0) NewSettings &= ~0x01; if (NewSettings == Settings) { |