From patchwork Fri Aug 24 04:27:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10574803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5898F112E for ; Fri, 24 Aug 2018 04:26:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 432702C2F0 for ; Fri, 24 Aug 2018 04:26:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37ABD2C2F6; Fri, 24 Aug 2018 04:26:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 D61B82C2F0 for ; Fri, 24 Aug 2018 04:26:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726455AbeHXH65 (ORCPT ); Fri, 24 Aug 2018 03:58:57 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:33428 "EHLO mail-wr1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbeHXH65 (ORCPT ); Fri, 24 Aug 2018 03:58:57 -0400 Received: by mail-wr1-f42.google.com with SMTP id v90-v6so6334739wrc.0 for ; Thu, 23 Aug 2018 21:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hC7SJUvQby4Zu/okz2LPf1G7rUYze715XYLiMNJnkAU=; b=oxPg0vo4bMPe65HhoD+/scryTKygKU3ZNHECajWslqNjGpbI0GMuEb8aO1mI9q/ZJs mcKVGuCLUaADzzRFG+gdHWCKFcC/gnF7jcPGZR01jsotU/QTCZCPtj3B/F6kRCVcSYe+ KXNJOcxScx3N9iBYXvIpD+dUqVCCbxjElIJqIV2tWy7gm1fg5K87/NdB5ySi+q2Z/Zsv aKloc2HHqvQJQg4B7+IN5iELw/tC5SmglyL5ylPKeXY2hCmM8jz57dORlvbFau72p6Z7 TKm3EdqUDFNXLN4jADO7l+bWT3aRwBMSruD72ArHGs8K0BMbYoAdLLKKb0MSjaU38IEK 9teQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hC7SJUvQby4Zu/okz2LPf1G7rUYze715XYLiMNJnkAU=; b=KRWGdW7gWI5QlEZImYZnQElx86+ALNNeLgLwUzCdOWN7+d8ytTaPMILMMPp2e5Deui hQe8HXACejwpgH8T/GK3zs0r3CCu61tsQl5Nb2p61gMwFyKn9GPZWI8IWVmsv2jLB1C7 h7AduuBBPS52IJoZeuWW7MJQFSlZpPjQCSBCzzbLfPnIUoaDOCUTiKGaE/tiEc0x+QPp 0GqPgG0TS2iYTT5Kc7/raU3MsD4YduneoXI87EdeR5RlydcTMIfdueV7CKZ1AK7FAHAo wPrDUeGnAlSpZ1NjC5mPL7ypFx8h4Fk++gHHLeee8JRKkUX9t12/M8XjryQ9RPCo3TTN aK6w== X-Gm-Message-State: APzg51BI3gl0MhohcLLau77yvEOAAXSN9b5h742SYPfoEfLl6iv+B44J y+QAwrncb/LXnbLeBH07ycI= X-Google-Smtp-Source: ANB0VdY3ArhdNqRVT6z2dvbRiT+LSQIHdwvW8MttJdTr8Ur7QEoSDPMfeUq55f7qNZWtiiqD4C89Lg== X-Received: by 2002:a5d:6451:: with SMTP id d17-v6mr12447wrw.64.1535084763734; Thu, 23 Aug 2018 21:26:03 -0700 (PDT) Received: from localhost.localdomain ([141.226.8.68]) by smtp.gmail.com with ESMTPSA id b5-v6sm3983740wrs.62.2018.08.23.21.26.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Aug 2018 21:26:03 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: fstests@vger.kernel.org Subject: [PATCH] open_by_handle: fix name of directory in error messages Date: Fri, 24 Aug 2018 07:27:55 +0300 Message-Id: <1535084875-22879-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dirname() modifies the string in dname, but we use that string in error messages later on to print the test dir name. Make another copy of test_dir for passing to dirname(). Signed-off-by: Amir Goldstein --- src/open_by_handle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/open_by_handle.c b/src/open_by_handle.c index 36f2b07..4fdfacd 100644 --- a/src/open_by_handle.c +++ b/src/open_by_handle.c @@ -123,6 +123,7 @@ int main(int argc, char **argv) int fd; int ret = 0; int failed = 0; + char mname[PATH_MAX]; char dname[PATH_MAX]; char fname[PATH_MAX]; char fname2[PATH_MAX]; @@ -240,9 +241,10 @@ int main(int argc, char **argv) * the dentry cache and the use of -ip flag combination would not * allow testing decode of dir file handle in cold dcache scenario. */ + strcpy(dname, test_dir); if (parent && !in_fd) { - strcpy(dname, test_dir); - mount_dir = dirname(dname); + strcpy(mname, test_dir); + mount_dir = dirname(mname); if (create) ret = mkdir(test_dir, 0700); if (ret < 0 && errno != EEXIST) {