Files
systemd/src
Lennart Poettering 3832cb90ba stdio-util: give snprintf_ok() some love
as per docs snprintf() can fail in which case it returns -1. The
snprintf_ok() macro so far unconditionally cast the return value of
snprintf() to size_t, which would turn -1 to (size_t) INT_MAX,
presumably, at least on 2 complements system.

Let's be more careful with types here, and first check if return value
is positive, before casting to size_t.

Also, while we are at it, let's return the input buffer as return value
or NULL instead of 1 or 0. It's marginally more useful, but more
importantly, is more inline with most of our other codebase that
typically doesn't use booleans to signal success.

All uses of snprintf_ok() don't care for the type of the return, hence
this change does not propagate anywhere else.
2021-08-19 09:19:03 +02:00
..
2021-08-18 22:01:09 +01:00
2021-08-18 13:36:14 +02:00
…
…
2021-08-18 13:36:14 +02:00
2021-08-10 14:55:50 +02:00
2021-08-10 17:08:00 +02:00
2021-08-11 09:34:45 +02:00
2021-08-11 09:34:45 +02:00
2021-08-10 17:08:00 +02:00