fname, strlen(fname)+1,
&elt, sizeof(CurFile)))
{
+ Dmsg1(2, "Can't add <%s> to file_list\n", fname);
/* TODO: check error */
}
#else /* HTABLE */
jcr->file_list->insert(item->fname, item);
#endif
- Dmsg2(500, "add fname=%s lstat=%s\n", fname, lstat);
+ Dmsg2(2, "add fname=<%s> lstat=%s\n", fname, lstat);
return true;
}
bool accurate_mark_file_as_seen(JCR *jcr, CurFile *elt)
{
bool ret=true;
+ CurFile deb;
#ifdef USE_TCHDB
elt->seen = 1;
elt->fname, strlen(elt->fname)+1,
elt, sizeof(CurFile)))
{
+ Dmsg1(2, "can't update <%s>\n", elt->fname);
ret = false; /* TODO: add error message */
}
-#else
+
+#else /* HTABLE */
CurFile *temp = (CurFile *)jcr->file_list->lookup(elt->fname);
temp->seen = 1;
#endif
}
#endif
+ if (found) {
+ Dmsg1(2, "lookup <%s> ok\n", fname);
+ }
+
return found;
}
16,
0); /* options like compression */
/* TODO: make accurate file unique */
- if(!tchdbopen(jcr->file_list, "/tmp/casket.hdb", HDBOWRITER | HDBOCREAT)){
+ POOL_MEM buf;
+ Mmsg(buf, "/tmp/casket.hdb.%i", jcr->JobId);
+ if(!tchdbopen(jcr->file_list, buf.c_str(), HDBOWRITER | HDBOCREAT)){
/* TODO: handle error creation */
//ecode = tchdbecode(hdb);
//fprintf(stderr, "open error: %s\n", tchdberrmsg(ecode));
}
accurate_mark_file_as_seen(jcr, &elt);
- Dmsg2(500, "accurate %s = %i\n", fname, stat);
+ Dmsg2(2, "accurate %s = %i\n", fname, stat);
bail_out:
unstrip_path(ff_pkt);
elt = &item;
/* traverse records */
tchdbiterinit(jcr->file_list);
- while((key = tchdbiternext2(jcr->file_list)) != NULL){
- tchdbget3(jcr->file_list, key, strlen(key), elt, sizeof(CurFile));
- ff_pkt->fname = key;
- ff_pkt->statp.st_mtime = elt->mtime;
- ff_pkt->statp.st_ctime = elt->ctime;
- encode_and_send_attributes(jcr, ff_pkt, stream);
-// free(key);
+ while((key = tchdbiternext2(jcr->file_list)) != NULL) {
+ if (tchdbget3(jcr->file_list,
+ key, strlen(key)+1,
+ elt, sizeof(CurFile)) != -1)
+ {
+ if (!elt->seen) {
+ ff_pkt->fname = key;
+ ff_pkt->statp.st_mtime = elt->mtime;
+ ff_pkt->statp.st_ctime = elt->ctime;
+ encode_and_send_attributes(jcr, ff_pkt, stream);
+ Dmsg1(2, "deleted <%s>\n", key);
+ }
+ // free(key);
+
+ } else { /* TODO: add error message */
+ Dmsg1(2, "No value for <%s> key\n", key);
+ }
}
#else
foreach_htable (elt, jcr->file_list) {
/* delete the object */
tchdbdel(jcr->file_list);
- unlink("/tmp/casket.hdb");
+ POOL_MEM buf;
+ Mmsg(buf, "/tmp/casket.hdb.%i", jcr->JobId);
+// unlink("/tmp/casket.hdb");
#else
jcr->file_list->destroy();
free(jcr->file_list);