From patchwork Tue Oct 30 17:25:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 29963 Received: (qmail 96346 invoked by alias); 30 Oct 2018 17:25:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 95938 invoked by uid 89); 30 Oct 2018 17:25:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Date: Tue, 30 Oct 2018 18:25:02 +0100 To: libc-alpha@sourceware.org Subject: [PATCH COMMITTED] support_blob_repeat: Call mkstemp directory for the backing file User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20181030172502.282774399457D@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) This avoids a warning during post-test cleanup. 2018-10-30 Florian Weimer * support/blob_repeat.c (allocate_big): Call mkstemp directly. 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); }