summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-16 15:43:06 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-16 15:43:06 +0000
commit7a66c7801698e8d191942d862e22964b3430f502 (patch)
tree821e6d43c07251bb83551c555359edc3da46de51 /util/nvmutil
parentd2d2fb778a6cf0fe78b4691ce878fb3d2fd0e09b (diff)
util/nvmutil: don't use SSIZE_MAX (not portable)
some old systems don't have ssize_t or size_t Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index f48413d4..4db3d582 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -543,8 +543,8 @@ static const char *mac_str = rmac;
static const char *fname = NULL;
static const char *argv0;
-#ifndef SSIZE_MAX
-#define SSIZE_MAX ((ssize_t)(~((size_t)1 << (sizeof(ssize_t)*CHAR_BIT-1))))
+#ifndef X_LONG_MAX
+#define X_LONG_MAX ((long)(~((long)1 << (sizeof(long)*CHAR_BIT-1))))
#endif
/*
@@ -2586,7 +2586,7 @@ io_args(int fd, void *mem, size_t nrw,
goto err_io_args;
/* prevent overflow */
- if (nrw > (size_t)SSIZE_MAX)
+ if (nrw > (size_t)X_LONG_MAX)
goto err_io_args;
/* prevent overflow */
@@ -2639,14 +2639,14 @@ rw_over_nrw(ssize_t r, size_t nrw)
if (r == -1)
return r;
- if ((size_t)r > SSIZE_MAX) {
+ if ((size_t)r > X_LONG_MAX) {
/*
* Theoretical buggy libc
* check. Extremely academic.
*
* Specifications never
* allow this return value
- * to exceed SSIZE_MAX, but
+ * to exceed SSIZE_T, but
* spec != implementation
*
* Check this after using