Signed-off-by: Alejandro Colomar <alx@kernel.org>
-// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include "config.h"
+#include <errno.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
len = vsnprintf(s, size, fmt, ap);
if (len == -1)
return -1;
- if ((size_t) len >= size)
+ if ((size_t) len >= size) {
+ errno = E2BIG;
return -1;
+ }
return len;
}
#include "config.h"
+#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
stpcpy(mempcpy(dst, src, dlen), "");
- if (trunc)
+ if (trunc) {
+ errno = E2BIG;
return -1;
+ }
return slen;
}