]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/string/: strerrno(): Use statement expression to perform lvalue conversion
authorAlejandro Colomar <alx@kernel.org>
Tue, 25 Nov 2025 21:51:28 +0000 (22:51 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 28 Nov 2025 03:26:49 +0000 (21:26 -0600)
commit910f54c083a74496cccbcea8e77490b9ce66b456
tree000c0f9e2ddac8acc061e8f14326438623d20225
parent4f523497dfcc4e0a035fc9817911e0932232a80a
lib/string/: strerrno(): Use statement expression to perform lvalue conversion

Compound literals are lvalues.  This means it's possible to take their
address.  That is, it would be possible (albeit nonsensical) to do

&strerrno();

It is also possible to assign to them (albeit also nonsensical):

strerrno() = NULL;

The statement expression performs lvalue conversion, which turns the
lvalue into an "rvalue", as expected, and disallows all those issues.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/string/strerrno.h