From: Alejandro Colomar Date: Tue, 25 Nov 2025 21:51:28 +0000 (+0100) Subject: lib/string/: strerrno(): Use statement expression to perform lvalue conversion X-Git-Tag: 4.19.0-rc1~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=910f54c083a74496cccbcea8e77490b9ce66b456;p=thirdparty%2Fshadow.git 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 --- diff --git a/lib/string/strerrno.h b/lib/string/strerrno.h index b82e1015c..9f28a86a4 100644 --- a/lib/string/strerrno.h +++ b/lib/string/strerrno.h @@ -13,7 +13,7 @@ // strerrno - string errno -#define strerrno() ((const char *){strerror(errno)}) +#define strerrno() ({(const char *){strerror(errno)};}) #endif // include guard