From 051e358f1422dffb52f2a47f86afd56351566373 Mon Sep 17 00:00:00 2001 From: ravinsp <33562092+ravinsp@users.noreply.github.com> Date: Tue, 18 Aug 2020 22:15:12 +0530 Subject: [PATCH] Fixed hpfs hash update issue. --- src/hpfs/hpfs.cpp | 18 +++++++++--------- test/bin/hpfs | Bin 219288 -> 219288 bytes 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hpfs/hpfs.cpp b/src/hpfs/hpfs.cpp index a2d0c2a2..b5b839f4 100644 --- a/src/hpfs/hpfs.cpp +++ b/src/hpfs/hpfs.cpp @@ -172,14 +172,14 @@ namespace hpfs int get_hash(h32 &hash, const std::string_view mount_dir, const std::string_view vpath) { - std::string path = std::string(mount_dir).append(vpath).append("::hpfs.hmap.hash"); - int fd = open(path.c_str(), O_RDONLY); + const std::string path = std::string(mount_dir).append(vpath).append("::hpfs.hmap.hash"); + const int fd = open(path.c_str(), O_RDONLY); if (fd == -1) { LOG_ERR << errno << ": Error opening hash file."; return -1; } - int res = read(fd, &hash, sizeof(h32)); + const int res = read(fd, &hash, sizeof(h32)); close(fd); if (res == -1) { @@ -191,8 +191,8 @@ namespace hpfs int get_file_block_hashes(std::vector &hashes, const std::string_view mount_dir, const std::string_view vpath) { - std::string path = std::string(mount_dir).append(vpath).append("::hpfs.hmap.children"); - int fd = open(path.c_str(), O_RDONLY); + const std::string path = std::string(mount_dir).append(vpath).append("::hpfs.hmap.children"); + const int fd = open(path.c_str(), O_RDONLY); if (fd == -1) return -1; @@ -207,7 +207,7 @@ namespace hpfs const int children_count = st.st_size / sizeof(h32); hashes.resize(children_count); - int res = read(fd, hashes.data(), st.st_size); + const int res = read(fd, hashes.data(), st.st_size); close(fd); if (res == -1) { @@ -219,8 +219,8 @@ namespace hpfs int get_dir_children_hashes(std::vector &hash_nodes, const std::string_view mount_dir, const std::string_view dir_vpath) { - std::string path = std::string(mount_dir).append(dir_vpath).append("::hpfs.hmap.children"); - int fd = open(path.c_str(), O_RDONLY); + const std::string path = std::string(mount_dir).append(dir_vpath).append("::hpfs.hmap.children"); + const int fd = open(path.c_str(), O_RDONLY); if (fd == -1) { LOG_ERR << errno << ": Error opening hash children nodes."; @@ -238,7 +238,7 @@ namespace hpfs const int children_count = st.st_size / sizeof(child_hash_node); hash_nodes.resize(children_count); - int res = read(fd, hash_nodes.data(), st.st_size); + const int res = read(fd, hash_nodes.data(), st.st_size); close(fd); if (res == -1) { diff --git a/test/bin/hpfs b/test/bin/hpfs index 18565a512be1c80d6febdbd2bc88a3439af8eae8..9f79c1f4739180333bff58b421d1e95df5517c0b 100755 GIT binary patch delta 1501 zcmYLJYfMx}6rMAe6-4O*x)ymTP(kIf?6PVx)aqIZ(^^v0;Gf1vQfo@I6r!YJ(kL#g zz24rWR+>TmQCiW0#R|1}sV^3!B1ua?5=%%GNZMu*(zHGzX>q4#?gHH(J2T%o=R4my zbLQ4GN7OV&G*!|0pS@YycYFKmIUhPwioRX0pUI7TcKUJ+?ahG-PjRkMoC{qg@V4Q+ z0OJ%gjYSvX9ZJJ1Pr{^)|I`c-#<@$-mBF=^LO*r58!)O{cMTl4KppThIxEUMz>0=eb|Dy zpXminT3+MT5R74J4_cFX;t-@kKHoS5tJ5n#k!f!+&08A?iaKM~(T*~EO=J+mBRBvYxte1;k zh-MQ|Z!`55|6BaTFm%Q(2$SNx>o5V@P0y)by}?UIAT@msiesJ$VXgL6`SypJvc_Vq zSG;Y=`U+U9JEr13jx-uaz?VmhXPx}}ae|>OrH3rg!sletM5yK&nbdt~CDRIOnO0QK zwDKlYen+-%3zqzUf>v4gSOywfrSacyq%d^U3&ZfndV{#x_OgG3FmD{mCU!B`ij-x@ zwBO=yND7GVTSZL$omGz4BF5Ak2V{YKER&|fW*%*)*|3A>+3BkA0Xrd&tlQiD`P^%# zYr(>Qw9~^;2Q4xTCr1m;@OOM`7Tpco_>C-@0ay6LEV?Et1D&ub8<>ucDE0u)anO{g z^L3cZ9E2d8%u5_J79MleL0%5u!1uub;3h_&`B3VGC%F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