libselinux: set errno on label lookup failure

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 <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Christian Göttsche 2023-08-14 14:09:02 +02:00 committed by James Carter
parent 168edd1ca2
commit 6df403d597
1 changed files with 1 additions and 0 deletions

View File

@ -407,6 +407,7 @@ static inline int compile_regex(struct spec *spec, const char **errbuf)
*errbuf = &regex_error_format_buffer[0];
}
__pthread_mutex_unlock(&spec->regex_lock);
errno = EINVAL;
return -1;
}