source: MondoRescue/branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c@ 2704

Last change on this file since 2704 was 2704, checked in by Bruno Cornec, 13 years ago

r4180@localhost: bruno | 2011-01-27 10:26:41 +0100

  • Fix multiple port issues from 2.2.9 that prevented mindi to work
  • Change interface of call_program_and_get_last_line_of_output to allow not logging (call to mindi)
  • Status is working boot, but NFS interface broken due to conf file issues
  • Property svn:keywords set to Id
File size: 20.6 KB
Line 
1/***************************************************************************
2 cvsid : $Id: mondo-rstr-compare.c 2704 2011-01-27 18:31:24Z bruno $
3***************************************************************************/
4
5#include <pthread.h>
6#include "my-stuff.h"
7#include "mr_mem.h"
8#include "../common/mondostructures.h"
9#include "../common/libmondo.h"
10//#include "../../config.h"
11#include "mr-externs.h"
12#include "mondo-rstr-compare.h"
13#include "mondo-restore-EXT.h"
14#include "mondo-rstr-tools-EXT.h"
15
16extern char *MONDO_LOGFILE;
17
18/* Reference to global bkpinfo */
19extern struct s_bkpinfo *bkpinfo;
20
21//static char cvsid[] = "$Id: mondo-rstr-compare.c 2704 2011-01-27 18:31:24Z bruno $";
22
23void popup_changelist_from_file(char *);
24
25
26/**
27 * @addtogroup LLcompareGroup
28 * @{
29 */
30/**
31 * Compare biggiefile number @p bigfileno with the filesystem mounted on @p MNT_RESTORING.
32 * @param bkpinfo The backup information structure. Only used in insist_on_this_cd_number().
33 * @param bigfileno The biggiefile number (starting from 0) to compare.
34 * @note This function uses an MD5 checksum.
35 */
36int compare_a_biggiefile(long bigfileno)
37{
38
39 FILE *fin;
40 FILE *fout;
41
42 /** needs malloc *******/
43 char *checksum = NULL;
44 char *original_cksum = NULL;
45 char *bigfile_fname = NULL;
46 char *tmp = NULL;
47 char *command = NULL;
48
49 char *p;
50 int i;
51 int retval = 0;
52
53 struct s_filename_and_lstat_info biggiestruct;
54
55 /*********************************************************************
56 * allocate memory clear test sab 16 feb 2003 *
57 *********************************************************************/
58 assert(bkpinfo != NULL);
59 /** end **/
60
61 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) {
62 if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
63 insist_on_this_cd_number((++g_current_media_number));
64 } else {
65 log_msg(2, "No CD's left. No biggiefiles left. No prob, Bob.");
66 return (0);
67 }
68 }
69 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
70 log_to_screen("Cannot open bigfile %ld (NULL)'s info file", bigfileno + 1);
71 return (1);
72 }
73 fread((void *) &biggiestruct, 1, sizeof(biggiestruct), fin);
74 paranoid_fclose(fin);
75
76 mr_asprintf(checksum, "%s", biggiestruct.checksum);
77 mr_asprintf(bigfile_fname, "%s", biggiestruct.filename);
78
79 log_msg(2, "biggiestruct.filename = %s", biggiestruct.filename);
80 log_msg(2, "biggiestruct.checksum = %s", biggiestruct.checksum);
81
82 if (!g_text_mode) {
83 mr_asprintf(tmp, "Comparing %s", bigfile_fname);
84 newtDrawRootText(0, 22, tmp);
85 paranoid_free(tmp);
86 newtRefresh();
87 }
88 if (!checksum[0]) {
89 log_msg(2, "Warning - %s has no checksum", bigfile_fname);
90 }
91 if (!strncmp(bigfile_fname, "/dev/", 5)) {
92 log_msg(2, "IGNORING %s as begining with /dev", bigfile_fname);
93 mr_free(bigfile_fname);
94 return (1);
95 }
96
97 mr_asprintf(command, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname);
98 log_msg(2, command);
99 i = system(command);
100 mr_free(command);
101
102 mr_asprintf(tmp, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
103 paranoid_system(tmp);
104 paranoid_free(tmp);
105
106 if (i) {
107 log_OS_error("Warning - command failed");
108 return (1);
109 } else {
110 if (!(fin = fopen("/tmp/md5sum.txt", "r"))) {
111 log_msg(2,
112 "Unable to open /tmp/md5sum.txt; can't get live checksum");
113 mr_free(bigfile_fname);
114 return (1);
115 } else {
116 mr_getline(original_cksum, fin);
117 paranoid_fclose(fin);
118 p = strchr(original_cksum, ' ');
119 if (p) {
120 *p = '\0';
121 }
122 }
123 }
124 mr_asprintf(tmp, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname);
125 if ((original_cksum != NULL) && (strcmp(checksum, original_cksum) == 0)) {
126 mr_strcat(tmp, " ... OK");
127 } else {
128 mr_strcat(tmp, "... changed");
129 retval++;
130 }
131 mr_free(checksum);
132 mr_free(original_cksum);
133
134 log_msg(1, tmp);
135 paranoid_free(tmp);
136
137 if (retval) {
138 if (!(fout = fopen(MONDO_CACHE"/changed.txt", "a"))) {
139 fatal_error("Cannot openout changed.txt");
140 }
141 fprintf(fout, "%s\n", bigfile_fname);
142 paranoid_fclose(fout);
143 }
144 mr_free(bigfile_fname);
145
146 return (retval);
147}
148
149/**************************************************************************
150 *END_COMPARE_A_BIGGIEFILE *
151 **************************************************************************/
152
153
154/**
155 * Compare all biggiefiles in the backup.
156 * @return 0 for success, nonzero for failure.
157 */
158int compare_all_biggiefiles()
159{
160 int retval = 0;
161 int res;
162 long noof_biggiefiles, bigfileno = 0;
163 char *tmp = NULL;
164
165 log_msg(1, "Comparing biggiefiles");
166
167 if (length_of_file(BIGGIELIST) < 6) {
168 log_msg(1,
169 "OK, really teeny-tiny biggielist; not comparing biggiefiles");
170 return (0);
171 }
172 noof_biggiefiles = count_lines_in_file(BIGGIELIST);
173 if (noof_biggiefiles <= 0) {
174 log_msg(1, "OK, no biggiefiles; not comparing biggiefiles");
175 return (0);
176 }
177 mvaddstr_and_log_it(g_currentY, 0,
178 "Comparing large files ");
179 open_progress_form("Comparing large files",
180 "I am now comparing the large files",
181 "against the filesystem. Please wait.", "",
182 noof_biggiefiles);
183 for (bigfileno = 0; bigfileno < noof_biggiefiles; bigfileno++) {
184 mr_asprintf(tmp, "Comparing big file #%ld", bigfileno + 1);
185 log_msg(1, tmp);
186 update_progress_form(tmp);
187 mr_free(tmp);
188
189 res = compare_a_biggiefile(bigfileno);
190 retval += res;
191 g_current_progress++;
192 }
193 close_progress_form();
194 return (0);
195 if (retval) {
196 mvaddstr_and_log_it(g_currentY++, 74, "Errors.");
197 } else {
198 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
199 }
200 return (retval);
201}
202
203/**************************************************************************
204 *END_COMPARE_ALL_BIGGIEFILES *
205 **************************************************************************/
206
207
208/**
209 * Compare afioball @p tarball_fname against the filesystem.
210 * You must be chdir()ed to the directory where the filesystem is mounted
211 * before you call this function.
212 * @param tarball_fname The filename of the tarball to compare.
213 * @param current_tarball_number The fileset number contained in @p tarball_fname.
214 * @return 0 for success, nonzero for failure.
215 */
216int compare_a_tarball(char *tarball_fname, int current_tarball_number)
217{
218 int retval = 0;
219 int res;
220 long noof_lines;
221 long archiver_errors;
222 bool use_star;
223
224 /*** needs malloc *********/
225 char *command = NULL;
226 char *tmp = NULL;
227 char *archiver_exe = NULL;
228 char *tmp1 = NULL;
229 char *filelist_name = NULL;
230 char *logfile = NULL;
231 char *compressor_exe = NULL;
232
233 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
234 assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
235 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);
236 noof_lines = count_lines_in_file(filelist_name);
237 mr_free(filelist_name);
238
239 if (strstr(tarball_fname, ".bz2")) {
240 mr_asprintf(compressor_exe, "bzip2");
241 } else if (strstr(tarball_fname, ".lzma")) {
242 mr_asprintf(compressor_exe, "lzma");
243 } else if (strstr(tarball_fname, ".gz")) {
244 mr_asprintf(compressor_exe, "gzip");
245 } else if (strstr(tarball_fname, ".lzo")) {
246 mr_asprintf(compressor_exe, "lzop");
247 }
248
249 if (use_star) {
250 mr_asprintf(archiver_exe, "star");
251 } else {
252 mr_asprintf(archiver_exe, "afio");
253 }
254
255 if (compressor_exe) {
256 tmp1 = find_home_of_exe(compressor_exe);
257 if (!tmp1) {
258 mr_free(tmp1);
259 mr_free(compressor_exe);
260 mr_free(archiver_exe);
261 fatal_error("(compare_a_tarball) Compression program missing");
262 }
263 mr_free(tmp1);
264
265 if (use_star) {
266 if (!strcmp(compressor_exe, "bzip2")) {
267 mr_strcat(archiver_exe, " -bz");
268 } else {
269 mr_free(compressor_exe);
270 mr_free(archiver_exe);
271 fatal_error("(compare_a_tarball) Please use only bzip2 with star");
272 }
273 } else {
274 // afio
275 mr_free(compressor_exe);
276 mr_asprintf(tmp, "%s", compressor_exe);
277 mr_asprintf(compressor_exe, "-P %s -Z", tmp);
278 mr_free(tmp);
279 }
280 }
281
282#ifdef __FreeBSD__
283#define BUFSIZE 512L
284#else
285#define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE
286#endif
287 mr_asprintf(logfile, "/tmp/afio.log.%d", current_tarball_number);
288
289 if (use_star) {
290 // doesn't use compressor_exe
291 mr_asprintf(command, "%s -diff H=exustar file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile);
292 } else {
293 mr_asprintf(command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile);
294 }
295 mr_free(compressor_exe);
296 paranoid_free(archiver_exe);
297
298#undef BUFSIZE
299
300 res = system(command);
301 retval += res;
302 if (res) {
303 log_OS_error(command);
304 log_msg(2, "Warning - afio returned error = %d", res);
305 }
306 mr_free(command);
307
308 if (length_of_file(logfile) > 5) {
309 mr_asprintf(command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile);
310 system(command);
311 mr_free(command);
312
313 archiver_errors = count_lines_in_file(logfile);
314 } else {
315 archiver_errors = 0;
316 }
317 if (archiver_errors) {
318 log_msg(1, "%ld difference%c in fileset #%d ", archiver_errors, (archiver_errors != 1) ? 's' : ' ', current_tarball_number);
319 }
320 unlink(logfile);
321 mr_free(logfile);
322
323 return (retval);
324}
325
326/**************************************************************************
327 *END_COMPARE_A_TARBALL *
328 **************************************************************************/
329
330
331/**
332 * Compare all afioballs in this backup.
333 * @param bkpinfo The backup media structure. Passed to other functions.
334 * @return 0 for success, nonzero for failure.
335 */
336int compare_all_tarballs()
337{
338 int retval = 0;
339 int res;
340 int current_tarball_number = 0;
341
342 /** needs malloc **********/
343
344 char *tarball_fname = NULL;
345 char *progress_str = NULL;
346 char *tmp = NULL;
347 char *mds = NULL;
348 long max_val;
349
350 assert(bkpinfo != NULL);
351 mvaddstr_and_log_it(g_currentY, 0, "Comparing archives");
352 tmp = read_cfg_var(MINDI_CACHE"/mondorestore.cfg", "last-filelist-number");
353 max_val = atol(tmp);
354 mr_free(tmp);
355
356 mds = media_descriptor_string(bkpinfo->backup_media_type);
357 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
358
359 open_progress_form("Comparing files",
360 "Comparing tarballs against filesystem.",
361 "Please wait. This may take some time.",
362 progress_str, max_val);
363
364 log_to_screen(progress_str);
365
366 for (;;) {
367 insist_on_this_cd_number(g_current_media_number);
368 update_progress_form(progress_str);
369 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);
370
371 if (!does_file_exist(tarball_fname)) {
372 mr_free(tarball_fname);
373 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);
374 }
375 if (!does_file_exist(tarball_fname)) {
376 mr_free(tarball_fname);
377 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzma", current_tarball_number);
378 }
379 if (!does_file_exist(tarball_fname)) {
380 mr_free(tarball_fname);
381 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);
382 }
383 if (!does_file_exist(tarball_fname)) {
384 mr_free(tarball_fname);
385 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);
386 }
387 if (!does_file_exist(tarball_fname)) {
388 mr_free(tarball_fname);
389 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);
390 }
391 if (!does_file_exist(tarball_fname)) {
392 mr_free(tarball_fname);
393 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);
394 }
395 if (!does_file_exist(tarball_fname)) {
396 if (!does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST") ||
397 system("find " MNT_CDROM
398 "/archives/slice* > /dev/null 2> /dev/null")
399 == 0) {
400 log_msg(2, "OK, I think I'm done with tarballs...");
401 mr_free(tarball_fname);
402 break;
403 }
404 log_msg(2, "OK, I think it's time for another CD...");
405 g_current_media_number++;
406
407 mr_free(progress_str);
408 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
409 log_to_screen(progress_str);
410 } else {
411 res = compare_a_tarball(tarball_fname, current_tarball_number);
412
413 g_current_progress++;
414 current_tarball_number++;
415 }
416 mr_free(tarball_fname);
417 }
418 mr_free(progress_str);
419 mr_free(mds);
420
421 close_progress_form();
422 if (retval) {
423 mvaddstr_and_log_it(g_currentY++, 74, "Errors.");
424 } else {
425 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
426 }
427 return (retval);
428}
429
430/**************************************************************************
431 *END_COMPARE_ALL_TARBALLS *
432 **************************************************************************/
433
434/* @} - end LLcompareGroup */
435
436
437/**
438 * @addtogroup compareGroup
439 * @{
440 */
441/**
442 * Compare all data on a CD-R/CD-RW/DVD/ISO/NFS-based backup.
443 * @param bkpinfo The backup information structure. Passed to other functions.
444 * @return 0 for success, nonzero for failure.
445 */
446int compare_to_CD()
447{
448 /** needs malloc *********/
449 char *tmp = NULL;
450 char *cwd, *new;
451 char *command = NULL;
452 int resA = 0;
453 int resB = 0;
454 long noof_changed_files;
455
456 malloc_string(cwd);
457 malloc_string(new);
458
459 assert(bkpinfo != NULL);
460
461 getcwd(cwd, MAX_STR_LEN - 1);
462 chdir(bkpinfo->restore_path);
463 getcwd(new, MAX_STR_LEN - 1);
464 insist_on_this_cd_number(g_current_media_number);
465 unlink(MONDO_CACHE"/changed.txt");
466
467 resA = compare_all_tarballs();
468 resB = compare_all_biggiefiles();
469 chdir(cwd);
470 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt");
471 if (noof_changed_files) {
472 mr_asprintf(tmp, "%ld files do not match the backup ", noof_changed_files);
473 log_to_screen(tmp);
474 mr_free(tmp);
475
476 mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);
477 paranoid_system(command);
478 mr_free(command);
479 } else {
480 mr_asprintf(tmp, "All files match the backup ");
481 mvaddstr_and_log_it(g_currentY++, 0, tmp);
482 log_to_screen(tmp);
483 mr_free(tmp);
484 }
485
486 paranoid_free(cwd);
487 paranoid_free(new);
488
489 return (resA + resB);
490}
491
492/**************************************************************************
493 *END_COMPARE_TO_CD *
494 **************************************************************************/
495
496
497
498
499/**
500 * Compare all data in the user's backup.
501 * This function will mount filesystems, compare afioballs and biggiefiles,
502 * and show the user the differences.
503 * @param bkpinfo The backup information structure. Passed to other functions.
504 * @param mountlist The mountlist containing partitions to mount.
505 * @param raidlist The raidlist containing the user's RAID devices.
506 * @return The number of errors/differences found.
507 */
508int
509compare_mode(struct mountlist_itself *mountlist,
510 struct raidlist_itself *raidlist)
511{
512 int retval = 0;
513 int res = 0;
514 long q;
515 char *tmp = NULL;
516 char *new;
517 char *cwd;
518
519 malloc_string(new);
520 malloc_string(cwd);
521
522 /**************************************************************************
523 * also deletes tmp/filelist.full & biggielist.txt _and_ tries to *
524 * restore them from start of tape, if available *
525 **************************************************************************/
526 assert(bkpinfo != NULL);
527 assert(mountlist != NULL);
528 assert(raidlist != NULL);
529
530 read_cfg_file_into_bkpinfo(MINDI_CACHE"/mondorestore.cfg");
531
532 /* edit_mountlist if wanted */
533 log_it("About to edit mountlist");
534 if (g_text_mode) {
535 save_mountlist_to_disk(mountlist, MINDI_CACHE"/mountlist.txt");
536 mr_asprintf(tmp, "%s %s", find_my_editor(), MINDI_CACHE"/mountlist.txt");
537 res = system(tmp);
538 mr_free(tmp);
539
540 load_mountlist(mountlist, MINDI_CACHE"/mountlist.txt");
541 } else {
542 res = edit_mountlist(MINDI_CACHE"/mountlist.txt", mountlist, raidlist);
543 }
544 log_it("Finished editing mountlist");
545 if (res) {
546 paranoid_MR_finish(1);
547 }
548 save_mountlist_to_disk(mountlist, MINDI_CACHE"/mountlist.txt");
549 save_raidlist_to_raidtab(raidlist, RAIDTAB_FNAME);
550
551 g_current_media_number = 1;
552 mvaddstr_and_log_it(1, 30, "Comparing Automatically");
553 log_it("Pre-MAD");
554 retval = mount_all_devices(mountlist, FALSE);
555 log_it("Post-MAD");
556 if (retval) {
557 unmount_all_devices(mountlist);
558 return (retval);
559 }
560 if (bkpinfo->backup_media_type == tape
561 || bkpinfo->backup_media_type == udev) {
562 retval += compare_to_tape();
563 } else if (bkpinfo->backup_media_type == cdstream) {
564 retval += compare_to_cdstream();
565 } else {
566 retval += compare_to_CD();
567 }
568 if (retval) {
569 mvaddstr_and_log_it(g_currentY++,
570 0,
571 "Warning - differences found during the compare phase");
572 }
573
574 if (count_lines_in_file(MONDO_CACHE"/changed.txt") > 0) {
575 mvaddstr_and_log_it(g_currentY++, 0,
576 "Differences found while files were being compared.");
577 streamline_changes_file(MONDO_CACHE"/changed.files", MONDO_CACHE"/changed.txt");
578 if (count_lines_in_file(MONDO_CACHE"/changed.files") <= 0) {
579 mvaddstr_and_log_it(g_currentY++, 0,
580 "...but they were logfiles and temporary files. Your archives are fine.");
581 log_to_screen
582 ("The differences were logfiles and temporary files. Your archives are fine.");
583 } else {
584 q = count_lines_in_file(MONDO_CACHE"/changed.files");
585 mr_asprintf(tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : "");
586 mvaddstr_and_log_it(g_currentY++, 0, tmp);
587 log_to_screen(tmp);
588 mr_free(tmp);
589
590 mr_asprintf(tmp, "Type 'less /tmp/changed.files' for a list of non-matching files");
591 mvaddstr_and_log_it(g_currentY++, 0, tmp);
592 log_to_screen(tmp);
593 mr_free(tmp);
594
595 log_msg(2, "calling popup_changelist_from_file()");
596 getcwd(cwd, MAX_STR_LEN - 1);
597 chdir(bkpinfo->restore_path);
598 getcwd(new, MAX_STR_LEN - 1);
599 popup_changelist_from_file(MONDO_CACHE"/changed.files");
600 chdir(cwd);
601 log_msg(2, "Returning from popup_changelist_from_file()");
602 }
603 } else {
604 log_to_screen
605 ("No significant differences were found. Your backup is perfect.");
606 }
607 retval += unmount_all_devices(mountlist);
608
609 kill_petris();
610 paranoid_free(new);
611 paranoid_free(cwd);
612 return (retval);
613}
614
615/**************************************************************************
616 *END_COMPARE_MODE *
617 **************************************************************************/
618
619/**
620 * Compare all data on a cdstream-based backup.
621 * @param bkpinfo The backup information structure. Fields used:
622 * - @c bkpinfo->disaster_recovery
623 * - @c bkpinfo->media_device
624 * - @c bkpinfo->restore_path
625 * @return 0 for success, nonzero for failure.
626 */
627int compare_to_cdstream()
628{
629 int res;
630
631 /** needs malloc **/
632 char *dir;
633
634 assert(bkpinfo != NULL);
635 malloc_string(dir);
636 getcwd(dir, MAX_STR_LEN);
637 chdir(bkpinfo->restore_path);
638
639 mvaddstr_and_log_it(g_currentY,
640 0, "Verifying archives against filesystem");
641
642 mr_free(bkpinfo->media_device);
643 if (bkpinfo->disaster_recovery && does_file_exist(MINDI_CACHE"/CDROM-LIVES-HERE")) {
644 bkpinfo->media_device = last_line_of_file(MINDI_CACHE"/CDROM-LIVES-HERE");
645 } else {
646 bkpinfo->media_device = find_cdrom_device(FALSE);
647 }
648 res = verify_tape_backups();
649 chdir(dir);
650 if (length_of_file(MONDO_CACHE"/changed.txt") > 2
651 && length_of_file(MONDO_CACHE"/changed.files") > 2) {
652 log_msg(0,
653 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives");
654 log_msg(2, "Calling popup_changelist_from_file()");
655 popup_changelist_from_file(MONDO_CACHE"/changed.files");
656 log_msg(2, "Returned from popup_changelist_from_file()");
657 }
658
659 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
660 paranoid_free(dir);
661 return (res);
662}
663
664/**************************************************************************
665 *END_COMPARE_CD_STREAM *
666 **************************************************************************/
667
668
669/**
670 * Compare all data on a tape-based backup.
671 * @param bkpinfo The backup information structure. Field used: @c bkpinfo->restore_path.
672 * @return 0 for success, nonzero for failure.
673 */
674/**************************************************************************
675 * F@COMPARE_TO_TAPE() *
676 * compare_to_tape() - gots me?? *
677 * *
678 * returns: int *
679 **************************************************************************/
680int compare_to_tape()
681{
682 int res;
683 char *dir;
684
685 assert(bkpinfo != NULL);
686 malloc_string(dir);
687
688 getcwd(dir, MAX_STR_LEN);
689 chdir(bkpinfo->restore_path);
690
691 mvaddstr_and_log_it(g_currentY,
692 0, "Verifying archives against filesystem");
693 res = verify_tape_backups();
694 chdir(dir);
695 if (res) {
696 mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
697 } else {
698 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
699 }
700 paranoid_free(dir);
701 return (res);
702}
703
704/**************************************************************************
705 *END_COMPARE_TO_TAPE *
706 **************************************************************************/
707
708/* @} - end compareGroup */
Note: See TracBrowser for help on using the repository browser.