From 1812deb9dd17f78fac1dd53fd997a21338768d5e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 14 Oct 2021 10:53:15 +0200 Subject: [PATCH] Check return value of mkdtemp --- src/templates_text/templator_text.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index ae4b05a..f82c3be 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -180,7 +180,7 @@ trexio_text_init (trexio_t* const file) Create a dummy temporary file for dummy locking. */ char dirname[TREXIO_MAX_FILENAME_LENGTH] = "/tmp/trexio.XXXXXX"; - mkdtemp(dirname); + if (mkdtemp(dirname) == NULL) return TREXIO_ERRNO; strncpy (file_name, dirname, TREXIO_MAX_FILENAME_LENGTH); strncat (file_name, lock_file_name, TREXIO_MAX_FILENAME_LENGTH-strlen(lock_file_name)); f->lock_file = open(file_name,O_WRONLY|O_CREAT|O_TRUNC, 0644);