source: MondoRescue/branches/3.1/mondo/src/mondorestore/mondo-rstr-compare.c@ 3161

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