From patchwork Fri Apr 28 12:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Berat X-Patchwork-Id: 68483 X-Patchwork-Delegate: siddhesh@gotplt.org Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2D22A385276B for ; Fri, 28 Apr 2023 12:39:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D22A385276B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682685545; bh=TF7S/xOt66PQ1MlirXA3lXPBNPbrD+GAX6jfAQnI2RM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=iiiE8S7CDKxj/HJllhnwfmrs0bxQmcniOzgjur5w1jBjreCV7dpFLtah4s96wenbv sM+mLww0k8RyRifPOmZXfE4OXbiFlXThyv96o1m14zrQ87jkJD6tOfb1UUiGbHu6oN 9PwKXcvJsr23jIO10JZlz/T2I7DCLj7Ki6A8ZJkA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1AF333857341 for ; Fri, 28 Apr 2023 12:35:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AF333857341 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-84-sJmDmDyOOrqqxBYUz5FLuw-1; Fri, 28 Apr 2023 08:35:32 -0400 X-MC-Unique: sJmDmDyOOrqqxBYUz5FLuw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CBB2280A330; Fri, 28 Apr 2023 12:35:32 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.193.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DF01C15BA0; Fri, 28 Apr 2023 12:35:31 +0000 (UTC) To: libc-alpha@sourceware.org Cc: siddhesh@gotplt.org, fberat@redhat.com Subject: [PATCH v4 12/15] tests: replace ftruncate by xftruncate Date: Fri, 28 Apr 2023 14:21:39 +0200 Message-Id: <20230428122142.928135-13-fberat@redhat.com> In-Reply-To: <20230418121130.844302-2-fberat@redhat.com> References: <20230428122142.928135-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_B=C3=A9rat_via_Libc-alpha?= From: Frederic Berat Reply-To: =?utf-8?b?RnLDqWTDqXJpYyBCw6lyYXQ=?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" With fortification enabled, ftruncate calls return result needs to be checked, has it gets the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar --- io/tst-copy_file_range.c | 2 +- posix/tst-getopt-cancel.c | 3 ++- stdio-common/tst-perror.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/io/tst-copy_file_range.c b/io/tst-copy_file_range.c index d1f3aaa5a9..bd64e9c42b 100644 --- a/io/tst-copy_file_range.c +++ b/io/tst-copy_file_range.c @@ -166,7 +166,7 @@ short_copy (void) inoff = 3; xlseek (infd, shift, SEEK_SET); } - ftruncate (outfd, 0); + xftruncate (outfd, 0); xlseek (outfd, 0, SEEK_SET); outoff = 0; diff --git a/posix/tst-getopt-cancel.c b/posix/tst-getopt-cancel.c index 7167d1a914..6f49391690 100644 --- a/posix/tst-getopt-cancel.c +++ b/posix/tst-getopt-cancel.c @@ -33,6 +33,7 @@ #include #include #include +#include static bool check_stderr (bool expect_errmsg, FILE *stderr_trapped) @@ -48,7 +49,7 @@ check_stderr (bool expect_errmsg, FILE *stderr_trapped) fputs (lineptr, stdout); } rewind (stderr_trapped); - ftruncate (fileno (stderr_trapped), 0); + xftruncate (fileno (stderr_trapped), 0); return got_errmsg == expect_errmsg; } diff --git a/stdio-common/tst-perror.c b/stdio-common/tst-perror.c index 57835e0c59..b4ab583462 100644 --- a/stdio-common/tst-perror.c +++ b/stdio-common/tst-perror.c @@ -9,6 +9,7 @@ #include #include +#include #define MB_EXP \ "null mode test 1: Invalid or incomplete multibyte or wide character\n" \ @@ -94,7 +95,7 @@ do_test (void) puts ("multibyte test succeeded"); lseek (fd, 0, SEEK_SET); - ftruncate (fd, 0); + xftruncate (fd, 0); if (dup2 (fd, 2) == -1) {