From 9981b5aeae60d2f7551781083dcdb1ba17064ced Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Wed, 5 Nov 2014 01:35:41 +0100 Subject: [PATCH] Fix some stuff and make getattr go through our class structure --- src/CryFuse.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/CryFuse.cpp b/src/CryFuse.cpp index ed438834..d8074ae2 100644 --- a/src/CryFuse.cpp +++ b/src/CryFuse.cpp @@ -5,6 +5,9 @@ #include #include +#include "cryfs_lib/CryNode.h" +#include "cryfs_lib/CryErrnoException.h" + #define UNUSED(expr) (void)(expr) using fusepp::path; @@ -25,11 +28,12 @@ CryFuse::CryFuse(CryDevice *device) } int CryFuse::getattr(const path &path, struct stat *stbuf) { - UNUSED(stbuf); - //printf("getattr(%s, _)\n", path.c_str()); - auto real_path = _device->RootDir() / path; - int retstat = lstat(real_path.c_str(), stbuf); - return errcode_map(retstat); + try { + _device->LoadFromPath(path)->stat(stbuf); + return 0; + } catch(cryfs::CryErrnoException &e) { + return -e.getErrno(); + } } int CryFuse::fgetattr(const path &path, struct stat *stbuf, fuse_file_info *fileinfo) {