From patchwork Sun Mar 29 17:43:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 38653 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 4271C385B836 for ; Sun, 29 Mar 2020 17:44:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4271C385B836 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 93C062EAE; Sun, 29 Mar 2020 19:44:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ncK11M4TyjlN; Sun, 29 Mar 2020 19:44:01 +0200 (CEST) Received: from function.home (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 83F462EB8; Sun, 29 Mar 2020 19:44:01 +0200 (CEST) Received: from samy by function.home with local (Exim 4.93) (envelope-from ) id 1jIbyZ-006IBw-P4; Sun, 29 Mar 2020 19:43:59 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: Make O_TRUNC update mtime/ctime Date: Sun, 29 Mar 2020 19:43:59 +0200 Message-Id: <20200329174359.1499855-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-25.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Sun, 29 Mar 2020 17:44:06 -0000 * hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Call __file_utimens after __file_set_size. --- hurd/lookup-retry.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index c90eda808d..6d8b05e4e6 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -178,8 +178,17 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) /* We got a successful translation. Now apply any open-time action flags we were passed. */ - if (!err && (flags & O_TRUNC)) /* Asked to truncate the file. */ - err = __file_set_size (*result, 0); + if (!err && (flags & O_TRUNC)) + { + /* Asked to truncate the file. */ + err = __file_set_size (*result, 0); + if (!err) + { + struct timespec atime = { 0, UTIME_OMIT }; + struct timespec mtime = { 0, UTIME_NOW }; + __file_utimens (*result, atime, mtime); + } + } if (err) __mach_port_deallocate (__mach_task_self (), *result);