diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2022-05-11 20:41:32 +0200 |
---|---|---|
committer | James Carter <jwcart2@gmail.com> | 2022-05-16 10:28:35 -0400 |
commit | 88d43a8dc2786aa45b1aa23b1dbc0551dd1e7de4 (patch) | |
tree | 72a6047e71ee994753a04ecb4e1b25ea8bcc487f /sandbox | |
parent | 8266fd9401b920bd3552410ebe215069891c373f (diff) | |
download | selinux-88d43a8dc2786aa45b1aa23b1dbc0551dd1e7de4.tar.gz |
libselinux: preserve errno in selinux_log()
selinux_log() is used in many error branches, where the caller might
expect errno to bet set, e.g. label_file.c::lookup_all():
if (match_count) {
*match_count = 0;
result = calloc(data->nspec, sizeof(struct spec*));
} else {
result = calloc(1, sizeof(struct spec*));
}
if (!result) {
selinux_log(SELINUX_ERROR, "Failed to allocate %zu bytes of data\n",
data->nspec * sizeof(struct spec*));
goto finish;
}
Preserve errno in the macro wrapper itself, also preventing accidental
errno modifications in client specified SELINUX_CB_LOG callbacks.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
Diffstat (limited to 'sandbox')
0 files changed, 0 insertions, 0 deletions