From: Amir Goldstein Date: Fri, 24 Aug 2018 04:27:55 +0000 (+0300) Subject: open_by_handle: fix name of directory in error messages X-Git-Tag: v2022.05.01~1433 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=2028376ff928617eadcf963fb86935901f260e4a open_by_handle: fix name of directory in error messages 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 Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/src/open_by_handle.c b/src/open_by_handle.c index 36f2b077..4fdfacd7 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) {