nvmutil: extremely defensive CHAR_BIT test

this program needs bits to be 8

some obscure systems set it to something else

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-17 18:27:14 +00:00
parent 38022c5d47
commit 611217e57e
+7 -3
View File
@@ -154,6 +154,13 @@ main(int argc, char *argv[])
unsigned long *i;
#ifndef CHAR_BIT
err(ECANCELED, "Unknown char size");
#else
if (CHAR_BIT != 8)
err(EINVAL, "Unsupported char size");
#endif
nv = new_xstate();
if (nv == NULL)
err(errno, NULL);
@@ -165,9 +172,6 @@ main(int argc, char *argv[])
if (nv->f.buf == NULL)
err(EINVAL, "Work buffer not initialised");
if (CHAR_BIT != 8)
err(EINVAL, "Unsupported char size");
f = &nv->f;
f->fname = argv[1];