exactness: make sure we handle a negative file descriptor

In an error case the fd could be negative here and we should check
before feeding it into fdopen(). This is the same patch we used in
recorder.c

CID: 1422194

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11728
This commit is contained in:
Stefan Schmidt 2020-04-17 15:23:44 +02:00
parent 25f4cba10d
commit 6b1ed0f573
1 changed files with 1 additions and 0 deletions

View File

@ -983,6 +983,7 @@ _setup_font_settings(const char *fonts_dir)
if (chosen_fonts)
{
int tmp_fd = eina_file_mkstemp("/tmp/fonts_XXXXXX.conf", &fonts_conf_name);
if (tmp_fd < 0) return EINA_FALSE;
FILE *tmp_f = fdopen(tmp_fd, "wb");
fprintf(tmp_f,
"<?xml version=\"1.0\"?>\n<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n<fontconfig>\n"