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: 990995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-96847-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="o/T3rYQD"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kz082NG4z9s9G for ; Wed, 31 Oct 2018 04:26:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= bJlCaIAml8z+2HtFxCEsStckpC9fiYofvod508j1xoOPnFEdxXHJFRMXpjm1wneT acVPXaulIv513W0MyCA0B99AuHxemPC4jAqkG2C73GnnBbDsX2a8OhB/7Pe65kE8 IA77q+/jY9rKQLVgpw8wHPTV5RvXKQ+xFAS4hyOX4Ug= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=k7zQ1F 7+qNEaQkKF2ZzGqilvSWk=; b=o/T3rYQDvhjyewFyGGwWsACOWmmx977BJJCvRi ZtFcxsLd2mweFaWnUNM/YaXgfWS7Wn9gS2jWOaTK6gtXsdGyb9In8jUwqG+f6yM8 N5UvnBc8VkPDzrtKUG/ZP9I2XEoZE0/mWZug1vkQLHi2hLvqe3FpbnjnYDqIFYgb fzo4Y= 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); }