diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-10 13:42:43 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-10 13:42:43 +0000 |
| commit | 06cb129530940ca7368eaa864388ba590bbbc7d8 (patch) | |
| tree | 11cd0245df617ba78d2035a3b9c20c972264c9f3 | |
| parent | 79106c5b3df54ef796fdd51f8d03765b51f1d109 (diff) | |
util/nvmutil: better SSIZE_MAX define
the old one assumes that ssize_t is signed size_t,
which let's face it, is always true in practise,
but not actually guaranteed!
so now i'm using one that's even more pedantic.
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index d834eea0..585f73bb 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -285,12 +285,8 @@ static const char *mac_str; static const char *fname; static const char *argv0; -#ifndef SIZE_MAX -#define SIZE_MAX ((size_t)-1) -#endif - #ifndef SSIZE_MAX -#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1)) +#define SSIZE_MAX ((ssize_t)(~((size_t)1 << (sizeof(ssize_t)*CHAR_BIT-1)))) #endif /* |
