static int MEGAgetattr(const char *p, struct stat *stbuf) { string path = megaBasePath + p; MegaApi::log(MegaApi::LOG_LEVEL_DEBUG, "Getting attributes:"); MegaApi::log(MegaApi::LOG_LEVEL_DEBUG, path.c_str()); MegaNode *n = megaApi->getNodeByPath(path.c_str()); if (!n) { MegaApi::log(MegaApi::LOG_LEVEL_DEBUG, "Node not found"); return -ENOENT; } stbuf->st_uid = getuid(); stbuf->st_gid = getgid(); stbuf->st_mode = n->isFile() ? S_IFREG | 0444 : S_IFDIR | 0755; stbuf->st_nlink = 1; stbuf->st_size = n->isFile() ? n->getSize() : 4096; stbuf->st_mtime = n->isFile() ? n->getModificationTime() : n->getCreationTime(); delete n; MegaApi::log(MegaApi::LOG_LEVEL_DEBUG, "Attributes read OK"); return 0; }