]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/findlib/find_one.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / findlib / find_one.c
index b4d8240d97a99d4687f3524f3c6600b4e81f73ac..1fcf0be1bf02dd243e5f41920fbf568fd0aaf479 100755 (executable)
@@ -28,8 +28,8 @@
 #include "bacula.h"
 #include "find.h"
 
-extern size_t name_max;              /* filename max length */
-extern size_t path_max;              /* path name max length */
+extern int32_t name_max;             /* filename max length */
+extern int32_t path_max;             /* path name max length */
 
 /*
  * Structure for keeping track of hard linked files, we   
@@ -133,6 +133,12 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt),
       /* Search link list of hard linked files */
       for (lp = ff_pkt->linklist; lp; lp = lp->next)
         if (lp->ino == ff_pkt->statp.st_ino && lp->dev == ff_pkt->statp.st_dev) {
+             /* If we have already backed up the hard linked file don't do it again */
+            if (strcmp(lp->name, fname) == 0) {
+                Jmsg1(jcr, M_WARNING, 0, _("Attempt to backup hard linked file %s twice ignored.\n"),
+                  fname);
+               return 1;             /* ignore */
+            }
             ff_pkt->link = lp->name;
             ff_pkt->type = FT_LNKSAVED;       /* Handle link, file already saved */
             ff_pkt->LinkFI = lp->FileIndex;
@@ -252,11 +258,16 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt),
        *   during the restore, the directory permissions will
        *   be reset after all the files have been restored.
        */
+      Dmsg1(300, "Create temp ff packet for dir: %s\n", ff_pkt->fname);
       FF_PKT *dir_ff_pkt = (FF_PKT *)bmalloc(sizeof(FF_PKT));
       memcpy(dir_ff_pkt, ff_pkt, sizeof(FF_PKT));
       dir_ff_pkt->fname = bstrdup(ff_pkt->fname);
       dir_ff_pkt->link = bstrdup(ff_pkt->link);
       dir_ff_pkt->sys_fname = get_pool_memory(PM_FNAME);
+      dir_ff_pkt->included_files_list = NULL;
+      dir_ff_pkt->excluded_files_list = NULL;
+      dir_ff_pkt->excluded_paths_list = NULL;
+      dir_ff_pkt->linklist = NULL;
        
       ff_pkt->link = ff_pkt->fname;     /* reset "link" */
 
@@ -324,7 +335,7 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt),
         if (status != 0 || result == NULL) {
            break;
         }
-        ASSERT(name_max+1 > sizeof(struct dirent) + (int)NAMELEN(entry));
+        ASSERT(name_max+1 > (int)sizeof(struct dirent) + (int)NAMELEN(entry));
         p = entry->d_name;
          /* Skip `.', `..', and excluded file names.  */
          if (p[0] == '\0' || (p[0] == '.' && (p[1] == '\0' ||
@@ -376,7 +387,18 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt),
     *  a block device, we do a raw backup of it or if it is
     *  a fifo, we simply read it.
     */
+#ifdef HAVE_FREEBSD_OS
+   /*
+    * On FreeBSD, all block devices are character devices, so
+    *  to be able to read a raw disk, we need the check for
+    *  a character device.
+    * crw-r-----  1 root  operator  - 116, 0x00040002 Jun  9 19:32 /dev/ad0s3
+    * crw-r-----  1 root  operator  - 116, 0x00040002 Jun  9 19:32 /dev/rad0s3
+    */
+   if (top_level && (S_ISBLK(ff_pkt->statp.st_mode) || S_ISCHR(ff_pkt->statp.st_mode))) {
+#else
    if (top_level && S_ISBLK(ff_pkt->statp.st_mode)) {
+#endif
       ff_pkt->type = FT_RAW;         /* raw partition */
    } else if (top_level && S_ISFIFO(ff_pkt->statp.st_mode) &&
              ff_pkt->flags & FO_READFIFO) {