[systemd-devel] [PATCH 2/5] libsystemd:terminal :fix uninitialized warning

Lennart Poettering lennart at poettering.net
Mon Nov 3 04:50:44 PST 2014


On Mon, 03.11.14 13:46, David Herrmann (dh.herrmann at gmail.com) wrote:

> static inline int negative_errno(void) {
>         assert_return(errno > 0, -EINVAL);
>         return -errno;
> }

Looks great to me!

But please add a comment next to it, explaining why to use this. I
mean, we should really clarify that "return -errno" is usually enough,
and "return negative_errno()" is really just about making gcc shut up,
and should not be used for cases unlike the one you ran into.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list