diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-03-08 18:26:30 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2019-03-08 18:26:30 +0100 |
commit | ad511a4f7ab22c360ded1d4074d9148087b5395d (patch) | |
tree | 647809656031d33078e84a80a6208924a3ee24e0 | |
parent | 5c7b95403cbbd62c225a78ed565efa0e76af54b0 (diff) |
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.
-rw-r--r-- | util.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 */ |