1 diff -Naur --exclude=qt-console --exclude=.svn --exclude='*~' bacula.org/src/dird/inc_conf.c bacula/src/dird/inc_conf.c
2 --- bacula.org/src/dird/inc_conf.c 2007-02-17 18:11:27.000000000 +0100
3 +++ bacula/src/dird/inc_conf.c 2007-02-17 17:47:16.000000000 +0100
5 {"noatime", store_opts, {0}, 0, 0, 0},
6 {"enhancedwild", store_opts, {0}, 0, 0, 0},
7 {"drivetype", store_drivetype, {0}, 0, 0, 0},
8 + {"checkchanges", store_opts, {0}, 0, 0, 0},
9 {NULL, NULL, {0}, 0, 0, 0}
17 + INC_KW_ENHANCEDWILD,
23 {"hfsplussupport", INC_KW_HFSPLUS},
24 {"noatime", INC_KW_NOATIME},
25 {"enhancedwild", INC_KW_ENHANCEDWILD},
26 + {"checkchanges", INC_KW_CHKCHANGES},
31 {"no", INC_KW_NOATIME, "0"},
32 {"yes", INC_KW_ENHANCEDWILD, "K"},
33 {"no", INC_KW_ENHANCEDWILD, "0"},
34 + {"yes", INC_KW_CHKCHANGES, "c"},
35 + {"no", INC_KW_CHKCHANGES, "0"},
39 diff -Naur --exclude=qt-console --exclude=.svn --exclude='*~' bacula.org/src/filed/backup.c bacula/src/filed/backup.c
40 --- bacula.org/src/filed/backup.c 2007-02-17 18:11:28.000000000 +0100
41 +++ bacula/src/filed/backup.c 2007-02-17 18:37:19.000000000 +0100
44 stat = send_data(jcr, data_stream, ff_pkt, digest, signing_digest);
47 + if (ff_pkt->flags & FO_CHKCHANGES) {
48 + file_have_changed(jcr, ff_pkt);
54 diff -Naur --exclude=qt-console --exclude=.svn --exclude='*~' bacula.org/src/filed/job.c bacula/src/filed/job.c
55 --- bacula.org/src/filed/job.c 2007-02-17 18:11:28.000000000 +0100
56 +++ bacula/src/filed/job.c 2007-02-17 18:37:19.000000000 +0100
59 fo->flags |= FO_NOATIME;
62 + fo->flags |= FO_CHKCHANGES;
65 Emsg1(M_ERROR, 0, _("Unknown include/exclude option: %c\n"), *p);
67 diff -Naur --exclude=qt-console --exclude=.svn --exclude='*~' bacula.org/src/findlib/find.h bacula/src/findlib/find.h
68 --- bacula.org/src/findlib/find.h 2007-02-17 18:11:57.000000000 +0100
69 +++ bacula/src/findlib/find.h 2007-02-17 14:07:59.000000000 +0100
71 #define FO_ENCRYPT (1<<21) /* Encrypt data stream */
72 #define FO_NOATIME (1<<22) /* Use O_NOATIME to prevent atime change */
73 #define FO_ENHANCEDWILD (1<<23) /* Enhanced wild card processing */
74 +#define FO_CHKCHANGES (1<<24) /* Check if file have been modified during backup */
76 struct s_included_file {
77 struct s_included_file *next;
78 diff -Naur --exclude=qt-console --exclude=.svn --exclude='*~' bacula.org/src/findlib/find_one.c bacula/src/findlib/find_one.c
79 --- bacula.org/src/findlib/find_one.c 2007-02-17 18:11:57.000000000 +0100
80 +++ bacula/src/findlib/find_one.c 2007-02-17 18:08:37.000000000 +0100
85 +/* check if a file have changed during backup and display an error */
86 +bool file_have_changed(JCR *jcr, FF_PKT *ff_pkt)
89 + Dmsg1(500, "file_have_changed fname=%s\n",ff_pkt->fname);
91 + if (ff_pkt->type != FT_REG) { /* not a regular file */
95 + if (lstat(ff_pkt->fname, &statp) != 0) {
97 + Jmsg(jcr, M_WARNING, 0,
98 + _("Can't check if %s have changed ERR=%s.\n"),ff_pkt->fname,be.strerror());
102 + if (statp.st_mtime != ff_pkt->statp.st_mtime) {
103 + /* TODO: add time of changes */
104 + Jmsg(jcr, M_ERROR, 0, _("%s have changed during backup.\n"), ff_pkt->fname);
108 + if (statp.st_ctime != ff_pkt->statp.st_ctime) {
109 + /* TODO: add time of changes */
110 + Jmsg(jcr, M_ERROR, 0, _("%s have changed during backup.\n"), ff_pkt->fname);
114 + if (statp.st_size != ff_pkt->statp.st_size) {
115 + /* TODO: add size change */
116 + Jmsg(jcr, M_ERROR, 0, _("%s size have changed during backup.\n"),ff_pkt->fname);
120 + if ((statp.st_blksize*statp.st_blocks) !=
121 + (ff_pkt->statp.st_blksize*ff_pkt->statp.st_blocks)) {
122 + /* TODO: add size change */
123 + Jmsg(jcr, M_ERROR, 0, _("%s size have changed during backup.\n"),ff_pkt->fname);
131 * Find a single file.
132 * handle_file is the callback for handling the file.
133 diff -Naur --exclude=qt-console --exclude=.svn --exclude='*~' bacula.org/src/findlib/protos.h bacula/src/findlib/protos.h
134 --- bacula.org/src/findlib/protos.h 2007-02-17 18:11:57.000000000 +0100
135 +++ bacula/src/findlib/protos.h 2007-02-17 12:34:18.000000000 +0100
137 int handle_file(FF_PKT *ff_pkt, void *hpkt, bool top_level),
138 void *pkt, char *p, dev_t parent_device, bool top_level);
139 int term_find_one(FF_PKT *ff);
141 +bool file_have_changed(JCR *jcr, FF_PKT *ff_pkt);
143 /* From get_priv.c */
144 int enable_backup_privileges(JCR *jcr, int ignore_errors);