src/streamfer*: Fix timestamps.
[nethome.git] / src / streamfer-server.C
index dedb9f3..5a0bd8a 100644 (file)
@@ -145,6 +145,8 @@ int main(int argc,char **argv) {
     fatal("Requested too new file");
   uint64_t offset;
   read_safe(client_fd,offset);
+  struct timespec mtim;
+  read_safe(client_fd,mtim);
   const string *fnp;
   int file_fd=-1;
   struct stat statbuf;
@@ -161,6 +163,9 @@ int main(int argc,char **argv) {
     assert(!err);
     if (offset<(uint64_t)statbuf.st_size)
       break;
+    static const struct timespec mtim_zero{};
+    if (memcmp(&mtim,&mtim_zero,sizeof(mtim))!=0&&memcmp(&mtim,&statbuf.st_mtim,sizeof(mtim))!=0)
+      break;
     if (offset>(uint64_t)statbuf.st_size)
       warning("File %s has transferred %zu < %zu which is its size",fn.c_str(),(size_t)offset,(size_t)statbuf.st_size);
     if (lastix==matched.size()-1&&execname)