]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/findlib/find.c
Fix possible race in heartbeat; set gnome-console default size
[bacula/bacula] / bacula / src / findlib / find.c
index 0f3af6176116315131b91b61ce7d5b84034c0ff6..e4d544e27469017c81e8d4d8c5ff45b78dd87d70 100644 (file)
 #include "bacula.h"
 #include "find.h"
 
-/* Imported functions */
-int find_one_file(FF_PKT *ff, int handle_file(FF_PKT *ff_pkt, void *hpkt), 
-              void *pkt, char *p, dev_t parent_device, int top_level);
-int term_find_one(FF_PKT *ff);
 
 size_t name_max;              /* filename max length */
 size_t path_max;              /* path name max length */
@@ -49,13 +45,13 @@ FF_PKT *init_find_files()
 {
   FF_PKT *ff;   
 
-  ff = (FF_PKT *) bmalloc(sizeof(FF_PKT));
+  ff = (FF_PKT *)bmalloc(sizeof(FF_PKT));
   memset(ff, 0, sizeof(FF_PKT));
 
   ff->sys_fname = get_pool_memory(PM_FNAME);
 
   init_include_exclude_files(ff);          /* init lists */
-  ff->mtime_only = 1;
+  ff->mtime_only = 0;                      /* use both st_mtime and st_ctime */
 
    /* Get system path and filename maximum lengths */
    path_max = pathconf(".", _PC_PATH_MAX);
@@ -80,11 +76,12 @@ FF_PKT *init_find_files()
  * of save_time. For additional options, see above
  */
 void
-set_find_options(FF_PKT *ff, int incremental, time_t save_time)
+set_find_options(FF_PKT *ff, int incremental, time_t save_time, int mtime_only)
 {
   Dmsg0(100, "Enter set_find_options()\n");
   ff->incremental = incremental;
   ff->save_time = save_time;
+  ff->mtime_only = mtime_only;
   Dmsg0(100, "Leave set_find_options()\n");
 }
 
@@ -106,17 +103,17 @@ set_find_options(FF_PKT *ff, int incremental, time_t save_time)
  *
  */
 int
-find_files(FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt), void *his_pkt) 
+find_files(JCR *jcr, FF_PKT *ff, int callback(FF_PKT *ff_pkt, void *hpkt), void *his_pkt) 
 {
-   char *file;
    struct s_included_file *inc = NULL;
 
-   while ((inc = get_next_included_file(ff, inc))) {
-      file = inc->fname;
-      strcpy(ff->VerifyOpts, inc->VerifyOpts); /* Copy options for this file */
-      Dmsg1(50, "find_files: file=%s\n", file);
-      if (!file_is_excluded(ff, file)) {
-        if (!find_one_file(ff, callback, his_pkt, file, (dev_t)-1, 1)) {
+   while (!job_canceled(jcr) && (inc = get_next_included_file(ff, inc))) {
+      /* Copy options for this file */
+      bstrncpy(ff->VerifyOpts, inc->VerifyOpts, sizeof(ff->VerifyOpts)); 
+      Dmsg1(50, "find_files: file=%s\n", inc->fname);
+      if (!file_is_excluded(ff, inc->fname)) {
+        if (!find_one_file(jcr, ff, callback, his_pkt, inc->fname, 
+             (dev_t)-1, 1)) {
            return 0;                  /* error return */
         }
       }