diff --git a/ChangeLog b/ChangeLog index 734defac22..eefe1ce397 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-10-30 Florian Weimer + + * support/blob_repeat.c (allocate_big): Call mkstemp directly. + 2018-10-30 Florian Weimer * stdlib/tst-strtod-overflow.c (do_test): Switch to diff --git a/support/blob_repeat.c b/support/blob_repeat.c index da4ca83043..16c1e448b9 100644 --- a/support/blob_repeat.c +++ b/support/blob_repeat.c @@ -23,8 +23,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -155,13 +155,17 @@ allocate_big (size_t total_size, const void *element, size_t element_size, if (target == MAP_FAILED) return (struct support_blob_repeat) { 0 }; - /* Create the backing file for the repeated mapping. */ + /* Create the backing file for the repeated mapping. Call mkstemp + directly to remove the resources backing the temporary file + immediately, once support_blob_repeat_free is called. Using + create_temp_file would result in a warning during post-test + cleanup. */ int fd; { - char *temppath; - fd = create_temp_file ("support_blob_repeat-", &temppath); + char *temppath = xasprintf ("%s/support_blob_repeat-XXXXXX", test_dir); + fd = mkstemp (temppath); if (fd < 0) - FAIL_EXIT1 ("create_temp_file: %m"); + FAIL_EXIT1 ("mkstemp (\"%s\"): %m", temppath); xunlink (temppath); free (temppath); }