From patchwork Fri Apr 27 16:34:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 10369395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BDF5601D3 for ; Fri, 27 Apr 2018 16:35:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F055A29249 for ; Fri, 27 Apr 2018 16:35:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E505F29498; Fri, 27 Apr 2018 16:35:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CF2229249 for ; Fri, 27 Apr 2018 16:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758820AbeD0QfC (ORCPT ); Fri, 27 Apr 2018 12:35:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:53232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758785AbeD0QfB (ORCPT ); Fri, 27 Apr 2018 12:35:01 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BF3B218CA; Fri, 27 Apr 2018 16:35:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BF3B218CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jlayton@kernel.org From: Jeff Layton To: fstests@vger.kernel.org, eguan@redhat.com Subject: [PATCH] fsync-err: don't truncate files on second open Date: Fri, 27 Apr 2018 12:34:59 -0400 Message-Id: <20180427163459.20864-1-jlayton@kernel.org> X-Mailer: git-send-email 2.14.3 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Layton ...and no need for O_CREAT flag. Signed-off-by: Jeff Layton --- src/fsync-err.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fsync-err.c b/src/fsync-err.c index 146688ddb01e..bd05dcc0a898 100644 --- a/src/fsync-err.c +++ b/src/fsync-err.c @@ -170,9 +170,9 @@ int main(int argc, char **argv) ret = fsync(fd[i]); if (ret < 0) { /* - * We did a failed write and fsync on each fd before. - * Now the error should be clear since we've not done - * any writes since then. + * We did a failed write and fsync on each fd + * before. Now the error should be clear since + * we've not done any writes since then. */ printf("Third fsync on fd[%d] failed: %m\n", i); return 1; @@ -220,7 +220,7 @@ int main(int argc, char **argv) printf("Close of fd[%d] returned unexpected error: %m\n", i); return 1; } - fd[i] = open(fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); + fd[i] = open(fname, O_WRONLY, 0644); if (fd[i] < 0) { printf("Second open of fd[%d] failed: %m\n", i); return 1;