Verified Commit 8b1abeb7 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

set device number in stat

command like cp are relying on the dev_no and ino_num to monitor if the
file have been changed during the copy operation.

dev_no was not properly set, thus it was random. Now it is always 0/0
parent dbd9ad79
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <sstream>
#include <csignal>
#include <random>
#include <sys/sysmacros.h>

using namespace std;

@@ -34,6 +35,7 @@ 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);
    attr.st_dev = makedev(0, 0);

    auto pos = db_val.find(dentry_val_delim);
    if (pos == std::string::npos) { // no delimiter found => no metadata enabled. fill with dummy values