Unverified Commit a984f116 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Always return inode number in stats

The `cp` command double check the inode number to detect file changes
during transfers, we need to set it properly and keep it consistent.

inode(file) = std::hash(file_path)
parent 2976d41f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -33,9 +33,10 @@ bool is_fs_path(const char* path) {
 */
int db_val_to_stat(const std::string path, std::string db_val, struct stat& attr) {

    attr.st_ino = std::hash<std::string>{}(path);
    
    auto pos = db_val.find(dentry_val_delim);
    if (pos == std::string::npos) { // no delimiter found => no metadata enabled. fill with dummy values
        attr.st_ino = std::hash<std::string>{}(path);
        attr.st_mode = static_cast<unsigned int>(stoul(db_val));
        attr.st_nlink = 1;
        attr.st_uid = CTX->fs_conf()->uid;