From 6df403d5976d234f9f971fdd26d12c9de4fc98bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 14 Aug 2023 14:09:02 +0200 Subject: [PATCH] libselinux: set errno on label lookup failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit selabel_lookup(3) is expected to set errno on lookup failure, i.e. when it returns NULL. Set errno if a regular expression failed to compile in compile_regex(). Signed-off-by: Christian Göttsche Acked-by: James Carter --- libselinux/src/label_file.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libselinux/src/label_file.h b/libselinux/src/label_file.h index ea02cd5ef..c91a6c189 100644 --- a/libselinux/src/label_file.h +++ b/libselinux/src/label_file.h @@ -407,6 +407,7 @@ static inline int compile_regex(struct spec *spec, const char **errbuf) *errbuf = ®ex_error_format_buffer[0]; } __pthread_mutex_unlock(&spec->regex_lock); + errno = EINVAL; return -1; }