Skip to content

Commit

Permalink
libselinux: set errno on label lookup failure
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed Oct 11, 2023
1 parent 168edd1 commit 6df403d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libselinux/src/label_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6df403d

Please sign in to comment.