From 8c8bfdb3e247b42846a96a2628ab3f3295c7b267 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 4 Nov 2010 14:06:09 -0700 Subject: [PATCH] CInode::make_path_string: don't coerce ino CInode::make_path_string: don't coerce the inode number to 32-bits. Everyone else is treating it as 64 bits; this function should too. Signed-off-by: Colin McCabe --- src/mds/CInode.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 2724249b35614..58101d65b4ab6 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -13,6 +13,7 @@ */ +#define __STDC_FORMAT_MACROS #include "CInode.h" #include "CDir.h" @@ -36,6 +37,7 @@ #include "messages/MLock.h" #include "messages/MClientCaps.h" +#include #include #include @@ -655,13 +657,16 @@ void CInode::make_path_string(string& s, bool force, CDentry *use_parent) s = ""; // root } else if (is_mdsdir()) { - char t[30]; - sprintf(t, "~mds%d", (int)ino() - MDS_INO_MDSDIR_OFFSET); + char t[40]; + uint64_t eino(ino()); + eino -= MDS_INO_MDSDIR_OFFSET; + snprintf(t, sizeof(t), "~mds%" PRId64, eino); s = t; } else { - char n[20]; - snprintf(n, sizeof(n), "#%llx", (unsigned long long)(ino())); + char n[40]; + uint64_t eino(ino()); + snprintf(n, sizeof(n), "#%" PRIx64, eino); s += n; } } -- 2.39.5