}
/* Does a file appear to be unchanged from the previous time it was backed up,
- * based on stat information?
- *
- * TODO: Notice files that were modified as they were being backed up the last
- * time. */
+ * based on stat information? */
bool MetadataWriter::is_unchanged(const struct stat *stat_buf)
{
+ if (old_metadata.find("volatile") != old_metadata.end()
+ && parse_int(old_metadata["volatile"]) != 0)
+ return false;
+
if (old_metadata.find("ctime") == old_metadata.end())
return false;
if (stat_buf->st_ctime != parse_int(old_metadata["ctime"]))
ssize_t len;
printf("%s\n", path.c_str());
+ metawriter->find(path);
file_info["name"] = uri_encode(path);
file_info["mode"] = encode_int(stat_buf.st_mode & 07777, 8);
file_info["user"] = encode_int(stat_buf.st_uid);
file_info["group"] = encode_int(stat_buf.st_gid);
+ time_t now = time(NULL);
+ if (now - stat_buf.st_ctime < 30 || now - stat_buf.st_mtime < 30)
+ if ((stat_buf.st_mode & S_IFMT) != S_IFDIR)
+ file_info["volatile"] = "1";
+
struct passwd *pwd = getpwuid(stat_buf.st_uid);
if (pwd != NULL) {
file_info["user"] += " (" + uri_encode(pwd->pw_name) + ")";
if (file_size != stat_buf.st_size) {
fprintf(stderr, "Warning: Size of %s changed during reading\n",
path.c_str());
+ file_info["volatile"] = "1";
}
break;