All pastes #978287 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-09 13:27 UTC
rendered paste body
index df05988..9b554b9 100644
--- a/bacula-2.2.8/src/findlib/find_one.c
+++ b/bacula-2.2.8/src/findlib/find_one.c
@@ -45,6 +45,7 @@
 #include <sys/mount.h>
 #include <sys/attr.h>
 #endif
+#include <sys/param.h>
 
 extern int32_t name_max;              /* filename max length */
 extern int32_t path_max;              /* path name max length */
@@ -490,6 +491,26 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt,
          }
       }
 
+      /*
+       * Ignore this directory and everything below if the file .nobackup
+       * exists
+       */
+      {
+        struct stat sb;
+        char fname[MAXPATHLEN];
+
+        if (strlen(ff_pkt->fname) + strlen("/.nobackup") + 1 > MAXPATHLEN)
+          return 1;    /* Is this wisdom? */
+
+        strcpy(fname, ff_pkt->fname);
+        strcat(fname, "/.nobackup");
+        if (stat(fname, &sb) == 0) {
+           Dmsg1(100, "Directory '%s' ignored (found .nobackup)\n",
+            ff_pkt->fname);
+           return 1;      /* Just ignore this directory */
+        }
+      }
+
       /* Build a canonical directory name with a trailing slash in link var */
       len = strlen(fname);
       link_len = len + 200;