From 8f58cc428ceb395abdc884b2ead382d897ad2511 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 22 Jul 2025 22:14:08 +0200 Subject: [PATCH] lib/string/: strerrno(): Add macro Signed-off-by: Alejandro Colomar --- lib/Makefile.am | 2 ++ lib/string/strerrno.c | 7 +++++++ lib/string/strerrno.h | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 lib/string/strerrno.c create mode 100644 lib/string/strerrno.h diff --git a/lib/Makefile.am b/lib/Makefile.am index b6420e3dc..60c4948d8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -247,6 +247,8 @@ libshadow_la_SOURCES = \ string/strdup/strndupa.h \ string/strdup/strndup.c \ string/strdup/strndup.h \ + string/strerrno.c \ + string/strerrno.h \ string/strftime.c \ string/strftime.h \ string/strspn/stpspn.c \ diff --git a/lib/string/strerrno.c b/lib/string/strerrno.c new file mode 100644 index 000000000..d7e817c03 --- /dev/null +++ b/lib/string/strerrno.c @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include "config.h" + +#include "string/strerrno.h" diff --git a/lib/string/strerrno.h b/lib/string/strerrno.h new file mode 100644 index 000000000..b82e1015c --- /dev/null +++ b/lib/string/strerrno.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2025, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_STRING_STRERRNO_H_ +#define SHADOW_INCLUDE_LIB_STRING_STRERRNO_H_ + + +#include "config.h" + +#include +#include + + +// strerrno - string errno +#define strerrno() ((const char *){strerror(errno)}) + + +#endif // include guard -- 2.47.3