From 45a3d5aaca4e1d64132d7b4190209bb743efaa68 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 8 Jun 2023 17:05:54 +0000 Subject: [PATCH] string: Have all functions return negative values on error Signed-off-by: Michael Tremer --- src/networkd/string.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/networkd/string.h b/src/networkd/string.h index 270ed6be..a36b0238 100644 --- a/src/networkd/string.h +++ b/src/networkd/string.h @@ -37,12 +37,11 @@ static inline int __nw_string_vformat(char* s, const size_t length, // Catch any errors if (required < 0) - return 1; + return required; // Check if the entire string could be written if ((size_t)required >= length) { - errno = ENOMEM; - return 1; + return -ENOMEM; } // Success -- 2.47.3