From ad511a4f7ab22c360ded1d4074d9148087b5395d Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 8 Mar 2019 18:26:30 +0100 Subject: util: pedantic snprintf improvement POSIX says about snprintf: "If an output error was encountered, these functions shall return a negative value". So check for < 0 instead of -1. Afaik all implementations return -1 though. --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.c b/util.c index e9461ea..e5d0ada 100644 --- a/util.c +++ b/util.c @@ -149,7 +149,7 @@ absuri(char *buf, size_t bufsiz, const char *link, const char *base) host, port[0] ? ":" : "", port); - if (r == -1 || (size_t)r >= sizeof(tmp)) + if (r < 0 || (size_t)r >= sizeof(tmp)) return -1; /* error or truncation */ /* relative to root */ -- cgit v1.2.3