exactness: make sure we handle a negative file descriptor
authorStefan Schmidt <s.schmidt@samsung.com>
Fri, 17 Apr 2020 12:12:48 +0000 (14:12 +0200)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 20 Apr 2020 21:11:28 +0000 (06:11 +0900)
In an error case the fd could be negative here and we should check
before feeding it into fdopen().

CID: 1422197

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11725

src/bin/exactness/recorder.c

index 35c747a..59a5549 100644 (file)
@@ -265,6 +265,7 @@ _setup_fonts_dir(const char *fonts_dir)
         if (_unit->fonts_path)
           {
              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"