Changeset 3205 in MondoRescue
- Timestamp:
- Dec 6, 2013, 3:40:47 PM (11 years ago)
- Location:
- branches/3.2/mondo/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-archive.c
r3197 r3205 526 526 527 527 /*@ long ********************************************************** */ 528 long lines_in_filelist = 0 ;528 long lines_in_filelist = 0L; 529 529 530 530 /*@ int ************************************************************* */ 531 531 int res = 0; 532 long estimated_total_noof_slices = 0 ;532 long estimated_total_noof_slices = 0L; 533 533 534 534 assert(bkpinfo != NULL); … … 608 608 609 609 update_evalcall_form(2); 610 if (!bkpinfo->nonbootable_backup 611 && (bkpinfo->boot_loader == '\0' 612 || bkpinfo->boot_device[0] == '\0')) { 610 if (!bkpinfo->nonbootable_backup && (bkpinfo->boot_loader == '\0' || bkpinfo->boot_device[0] == '\0')) { 613 611 614 612 #ifdef __FreeBSD__ 615 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 616 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 613 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 617 614 if (!bootdev[0]) { 618 615 mr_free(bootdev); 619 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 620 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 616 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 621 617 } 622 618 #else 623 619 /* Linux */ 624 620 #ifdef __IA64__ 625 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 626 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 621 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 627 622 #else 628 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 629 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 623 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 630 624 #endif 631 625 if (strstr(bootdev, "/dev/cciss/")) { 632 626 mr_free(bootdev); 633 627 #ifdef __IA64__ 634 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 635 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 628 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 636 629 #else 637 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 638 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 630 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 639 631 #endif 640 632 } 641 633 if (!bootdev[0]) { 642 634 mr_free(bootdev); 643 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 644 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 635 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 645 636 if (strstr(bootdev, "/dev/cciss/")) { 646 637 mr_free(bootdev); 647 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 648 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 638 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 649 639 } 650 640 } … … 675 665 bkpinfo->boot_loader != 'E' && 676 666 #endif 677 bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' 678 && bkpinfo->boot_loader != 'R' 679 && !bkpinfo->nonbootable_backup) { 680 fatal_error 681 ("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual."); 667 bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' && bkpinfo->boot_loader != 'R' && !bkpinfo->nonbootable_backup) { 668 fatal_error("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual."); 682 669 } 683 670 if (bkpinfo->boot_loader == 'L') { 684 671 mr_asprintf(bootldr_str, "LILO"); 685 672 if (!does_file_exist("/etc/lilo.conf")) { 673 mr_free(bootldr_str); 686 674 fatal_error("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?"); 687 675 } … … 692 680 } 693 681 if ((!does_file_exist("/boot/grub/menu.lst")) && (!does_file_exist("/boot/grub/grub.cfg")) && (!does_file_exist("/boot/grub2/grub.cfg"))) { 682 mr_free(bootldr_str); 694 683 fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?"); 695 684 } … … 697 686 } else if (bkpinfo->boot_loader == 'E') { 698 687 mr_asprintf(bootldr_str, "ELILO"); 699 /* BCO: fix it for Debian, Ma ndrake, ... */688 /* BCO: fix it for Debian, Mageia, ... */ 700 689 if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) { 701 690 run_program_and_log_output("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 5); … … 711 700 } 712 701 if (!does_file_exist("/etc/elilo.conf")) { 702 mr_free(bootldr_str); 713 703 fatal_error("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'"); 714 704 } … … 783 773 log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__); 784 774 } 785 mr_free(value);786 775 mr_free(tmp); 787 776 … … 791 780 log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__); 792 781 } 793 mr_free(bootldr_str);782 r_free(bootldr_str); 794 783 mr_free(tmp); 795 784 … … 814 803 mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir); 815 804 if (write_one_liner_data_file(tmp1, "TRUE")) { 816 log_msg(1, "%ld: Unable to write one-liner XATTR", 817 __LINE__); 818 } 819 paranoid_free(tmp1); 805 log_msg(1, "%ld: Unable to write one-liner XATTR", __LINE__); 806 } 807 mr_free(tmp1); 820 808 } 821 809 if (g_getfacl) { 822 810 mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir); 823 811 if (write_one_liner_data_file(tmp1, "TRUE")) { 824 log_msg(1, "%ld: Unable to write one-liner ACL", 825 __LINE__); 826 } 827 paranoid_free(tmp1); 812 log_msg(1, "%ld: Unable to write one-liner ACL", __LINE__); 813 } 814 mr_free(tmp1); 828 815 } 829 816 if (bkpinfo->use_obdr) { 830 817 mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir); 831 818 if (write_one_liner_data_file(tmp1, "TRUE")) { 832 log_msg(1, "%ld: Unable to write one-liner OBDR", 833 __LINE__); 834 } 835 paranoid_free(tmp1); 819 log_msg(1, "%ld: Unable to write one-liner OBDR", __LINE__); 820 } 821 mr_free(tmp1); 836 822 } 837 823 … … 876 862 MONDO_LOGFILE); 877 863 864 mr_free(tmp2); 865 mr_free(tape_device); 866 mr_free(tape_size_sz); 867 mr_free(use_lzo_sz); 868 mr_free(cd_recovery_sz); 869 mr_free(broken_bios_sz); 878 870 mr_free(last_filelist_number); 879 mr_free(tape_device); 880 mr_free(use_lzo_sz); 871 mr_free(use_comp_sz); 872 mr_free(use_lilo_sz); 873 mr_free(use_star_sz); 881 874 mr_free(use_gzip_sz); 882 875 mr_free(use_lzma_sz); 883 mr_free(use_star_sz); 884 mr_free(use_comp_sz); 885 mr_free(broken_bios_sz); 886 mr_free(cd_recovery_sz); 887 mr_free(use_lilo_sz); 888 mr_free(tape_size_sz); 876 mr_free(value); 889 877 890 878 /* This parameter is always the last one and optional */ … … 1183 1171 * @ingroup MLarchiveGroup 1184 1172 */ 1185 int do_that_initial_phase() 1186 { 1173 int do_that_initial_phase() { 1187 1174 /*@ int *************************************** */ 1188 1175 int retval = 0; … … 1229 1216 mr_free(data_disks_file); 1230 1217 1231 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix); 1218 if (bkpinfo->netfs_remote_dir != NULL) { 1219 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix); 1220 } else { 1221 mr_asprintf(command, "rm -f %s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->prefix); 1222 } 1232 1223 paranoid_system(command); 1233 1224 mr_free(command); … … 1236 1227 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1237 1228 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1238 write_header_block_to_stream((off_t)0, "start-of-tape", 1239 BLK_START_OF_TAPE); 1240 write_header_block_to_stream((off_t)0, "start-of-backup", 1241 BLK_START_OF_BACKUP); 1229 write_header_block_to_stream((off_t)0, "start-of-tape", BLK_START_OF_TAPE); 1230 write_header_block_to_stream((off_t)0, "start-of-backup", BLK_START_OF_BACKUP); 1242 1231 } 1243 1232 return (retval); … … 1355 1344 srand((unsigned int) getpid()); 1356 1345 g_sem_key = 1234 + random() % 30000; 1357 if ((g_sem_id = 1358 semget((key_t) g_sem_key, 1, 1359 IPC_CREAT | S_IREAD | S_IWRITE)) == -1) { 1346 if ((g_sem_id = semget((key_t) g_sem_key, 1, IPC_CREAT | S_IREAD | S_IWRITE)) == -1) { 1360 1347 fatal_error("MABAI - unable to semget"); 1361 1348 } … … 1366 1353 log_msg(8, "Creating thread #%d", noof_threads); 1367 1354 (*p_archival_threads_running)++; 1368 if ((res = 1369 pthread_create(&archival_thread[noof_threads], NULL, 1370 create_afio_files_in_background, 1371 (void *) transfer_block))) { 1355 if ((res = pthread_create(&archival_thread[noof_threads], NULL, create_afio_files_in_background, (void *) transfer_block))) { 1372 1356 fatal_error("Unable to create an archival thread"); 1373 1357 } … … 1381 1365 if (*p_archival_threads_running == 0 1382 1366 && *p_last_set_archived == storing_set_no - 1) { 1383 log_msg(2, 1384 "No archival threads are running. The last stored set was %d and I'm looking for %d. Take off your make-up; the party's over... :-)", 1385 *p_last_set_archived, storing_set_no); 1367 log_msg(2, "No archival threads are running. The last stored set was %d and I'm looking for %d. Take off your make-up; the party's over... :-)", *p_last_set_archived, storing_set_no); 1386 1368 done_storing = TRUE; 1387 1369 } else 1388 if (!get_bit_N_of_array 1389 (p_list_of_fileset_flags, storing_set_no)) { 1390 misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5; 1391 /* BCO the media_usage_comment is not really initialized there ! 1392 if (!misc_counter_that_is_not_important) { 1393 update_progress_form(media_usage_comment); 1394 } 1395 */ 1396 sleep(1); 1370 if (!get_bit_N_of_array(p_list_of_fileset_flags, storing_set_no)) { 1371 misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5; 1372 sleep(1); 1397 1373 } else { 1398 1374 // store set N … … 1407 1383 1408 1384 log_msg(2, "Storing set %d", storing_set_no); 1409 while (!does_file_exist(storing_filelist_fname) 1410 || !does_file_exist(storing_afioball_fname)) { 1411 log_msg(2, 1412 "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.", 1413 storing_filelist_fname, storing_afioball_fname); 1385 while (!does_file_exist(storing_filelist_fname) || !does_file_exist(storing_afioball_fname)) { 1386 log_msg(2, "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.", storing_filelist_fname, storing_afioball_fname); 1414 1387 sleep(5); 1415 1388 } 1416 1389 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ 1417 1390 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1418 register_in_tape_catalog(fileset, storing_set_no, -1, 1419 storing_afioball_fname); 1391 register_in_tape_catalog(fileset, storing_set_no, -1, storing_afioball_fname); 1420 1392 maintain_collection_of_recent_archives(bkpinfo->tmpdir, storing_afioball_fname); 1421 1393 log_it("Writing EXAT files"); 1422 res += 1423 write_EXAT_files_to_tape(curr_xattr_list_fname, 1424 curr_acl_list_fname); 1394 res += write_EXAT_files_to_tape(curr_xattr_list_fname, curr_acl_list_fname); 1425 1395 // archives themselves 1426 res += 1427 move_files_to_stream(storing_afioball_fname, 1428 NULL); 1396 res += move_files_to_stream(storing_afioball_fname, NULL); 1429 1397 } else { 1430 1398 if (g_getfacl) { 1431 1399 if (g_getfattr) { 1432 res = move_files_to_cd(storing_filelist_fname, 1433 curr_xattr_list_fname, 1434 curr_acl_list_fname, 1435 storing_afioball_fname, NULL); 1400 res = move_files_to_cd(storing_filelist_fname, curr_xattr_list_fname, curr_acl_list_fname, storing_afioball_fname, NULL); 1436 1401 } else { 1437 res = move_files_to_cd(storing_filelist_fname, 1438 curr_acl_list_fname, 1439 storing_afioball_fname, NULL); 1402 res = move_files_to_cd(storing_filelist_fname, curr_acl_list_fname, storing_afioball_fname, NULL); 1440 1403 } 1441 1404 } else { 1442 1405 if (g_getfattr) { 1443 res = move_files_to_cd(storing_filelist_fname, 1444 curr_xattr_list_fname, 1445 storing_afioball_fname, NULL); 1406 res = move_files_to_cd(storing_filelist_fname, curr_xattr_list_fname, storing_afioball_fname, NULL); 1446 1407 } else { 1447 res = move_files_to_cd(storing_filelist_fname, 1448 storing_afioball_fname, NULL); 1408 res = move_files_to_cd(storing_filelist_fname, storing_afioball_fname, NULL); 1449 1409 } 1450 1410 } … … 1967 1927 char *ntfsprog_fifo = NULL; 1968 1928 /*@ long *********************************************** */ 1969 long biggie_file_number = 0 ;1970 long noof_biggie_files = 0 ;1971 long estimated_total_noof_slices = 0 ;1929 long biggie_file_number = 0L; 1930 long noof_biggie_files = 0L; 1931 long estimated_total_noof_slices = 0L; 1972 1932 1973 1933 /*@ int ************************************************ */ … … 1983 1943 assert_string_is_neither_NULL_nor_zerolength(biggielist_fname); 1984 1944 1985 estimated_total_noof_slices = 1986 size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1; 1987 1988 log_msg(1, "size of all biggiefiles = %ld", 1989 size_of_all_biggiefiles_K()); 1990 log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", 1991 size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, 1992 estimated_total_noof_slices); 1945 estimated_total_noof_slices = size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1L; 1946 1947 log_msg(1, "size of all biggiefiles = %ld", size_of_all_biggiefiles_K()); 1948 log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, estimated_total_noof_slices); 1993 1949 1994 1950 if (length_of_file(biggielist_fname) < 6) { … … 2102 2058 2103 2059 log_msg(1, "Finished backing up bigfiles"); 2104 log_msg(1, "estimated slices = %ld; actual slices = %ld", 2105 estimated_total_noof_slices, g_current_progress); 2060 log_msg(1, "estimated slices = %ld; actual slices = %ld", estimated_total_noof_slices, g_current_progress); 2106 2061 close_progress_form(); 2107 2062 paranoid_fclose(fin); … … 2254 2209 assert(bkpinfo != NULL); 2255 2210 2256 mvaddstr_and_log_it(g_currentY, 0, 2257 "Archiving regular files to media "); 2211 mvaddstr_and_log_it(g_currentY, 0, "Archiving regular files to media "); 2258 2212 2259 2213 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2260 write_header_block_to_stream((off_t)0, "start-of-afioballs", 2261 BLK_START_AFIOBALLS); 2214 write_header_block_to_stream((off_t)0, "start-of-afioballs", BLK_START_AFIOBALLS); 2262 2215 #if __FreeBSD__ == 5 2263 log_msg(1, 2264 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2216 log_msg(1, "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2265 2217 res = make_afioballs_and_images_OLD(); 2266 2218 #else -
branches/3.2/mondo/src/common/libmondo-cli.c
r3194 r3205 236 236 if (!strcmp(bkpinfo->include_paths, "/")) { 237 237 log_msg(2, "'/' is pleonastic."); 238 bkpinfo->include_paths[0] = '\0';238 mr_free(bkpinfo->include_paths); 239 239 } 240 240 if (bkpinfo->include_paths[0]) { 241 strcat(bkpinfo->include_paths, "|");241 mr_strcat(bkpinfo->include_paths, "|"); 242 242 } 243 243 … … 454 454 *p = '\0'; 455 455 } 456 mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*[%s@]*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_user, bkpinfo->netfs_mount); 456 if (bkpinfo->netfs_user != NULL) { 457 mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*[%s@]*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_user, bkpinfo->netfs_mount); 458 } else { 459 mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 460 } 457 461 strncpy(bkpinfo->isodir, call_program_and_get_last_line_of_output(tmp), MAX_STR_LEN / 4); 458 462 mr_free(tmp1); … … 679 683 sprintf(tmp, "ls -l %s", bkpinfo->isodir); 680 684 if (run_program_and_log_output(tmp, 2)) { 681 fatal_error 682 ("output folder does not exist - please create it"); 685 fatal_error("output folder does not exist - please create it"); 683 686 } 684 687 } else if (flag_set['n']) { -
branches/3.2/mondo/src/common/libmondo-devices.c
r3196 r3205 2561 2561 } 2562 2562 if (bkpinfo->netfs_remote_dir == NULL) { 2563 fatal_error("bkpinfo->netfs_remote_dir sho ld not be NULL");2563 fatal_error("bkpinfo->netfs_remote_dir should not be NULL"); 2564 2564 } 2565 2565 strcpy(tmp1, bkpinfo->netfs_remote_dir); … … 2584 2584 } 2585 2585 log_msg(3, "prefix set to %s", bkpinfo->prefix); 2586 2587 2586 log_msg(3, "Just set netfs_remote_dir to %s", bkpinfo->netfs_remote_dir); 2588 2587 log_msg(3, "isodir is still %s", bkpinfo->isodir); … … 2688 2687 bkpinfo->boot_loader = i; 2689 2688 2690 mr_free(bkpinfo->include_paths); 2691 strcpy(tmp1, "/"); 2689 if (bkpinfo->include_paths) { 2690 strcpy(tmp1, bkpinfo->include_paths); 2691 mr_free(bkpinfo->include_paths); 2692 } else { 2693 strcpy(tmp1, "/"); 2694 } 2692 2695 if (!popup_and_get_string 2693 2696 ("Backup paths", … … 2831 2834 log_it("compression = %ld", bkpinfo->compression_level); 2832 2835 log_it("exclude_path = %s", bkpinfo->exclude_paths); 2833 log_it("include_path = %s", bkpinfo->include_paths); 2836 if (bkpinfo->include_paths) { 2837 log_it("include_path = %s", bkpinfo->include_paths); 2838 } 2834 2839 2835 2840 /* Handle devices passed in bkpinfo and print result */ … … 3010 3015 * The mountpoint (where it's mounted) will obviously be '/'. 3011 3016 */ 3012 char *where_is_root_mounted() 3013 { 3014 3015 3017 char *where_is_root_mounted() { 3018 3019 /*@ buffers **************** */ 3020 static char tmp[MAX_STR_LEN]; 3016 3021 3017 3022 3018 3023 #ifdef __FreeBSD__ 3019 strcpy(tmp, call_program_and_get_last_line_of_output 3020 ("mount | grep \" on / \" | cut -d' ' -f1")); 3024 strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1")); 3021 3025 #else 3022 strcpy(tmp, call_program_and_get_last_line_of_output 3023 ("mount | grep \" on / \" | cut -d' ' -f1 | sed s/[0-9]// | sed s/[0-9]//")); 3026 strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1 | sed s/[0-9]// | sed s/[0-9]//")); 3024 3027 if (strstr(tmp, "/dev/cciss/")) { 3025 strcpy(tmp, call_program_and_get_last_line_of_output 3026 ("mount | grep \" on / \" | cut -d' ' -f1 | cut -dp -f1")); 3028 strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1 | cut -dp -f1")); 3027 3029 } 3028 3030 if (strstr(tmp, "/dev/md")) { 3029 strcpy(tmp, 3030 call_program_and_get_last_line_of_output 3031 ("mount | grep \" on / \" | cut -d' ' -f1")); 3032 } 3033 #endif 3034 3035 return (tmp); 3031 strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1")); 3032 } 3033 #endif 3034 3035 return (tmp); 3036 3036 } 3037 3037 -
branches/3.2/mondo/src/common/libmondo-filelist.c
r3194 r3205 1302 1302 struct dirent *dit; 1303 1303 struct stat statbuf; 1304 char *new ;1304 char *new = NULL; 1305 1305 char *tmp = NULL; 1306 1306 char *dir = NULL; 1307 1307 static int percentage = 0; 1308 1308 char *skip_these = NULL; 1309 char *new_with_pipe ;1309 char *new_with_pipe = NULL; 1310 1310 char *strtmp = NULL; 1311 1311 char *token = NULL; … … 1395 1395 mr_free(find_skeleton_marker); 1396 1396 } 1397 mr_free(dir); 1397 1398 1398 1399 depth++; 1399 1400 1400 // log_msg(0, "Cataloguing %s", dir);1401 1401 mr_asprintf(skip_these, "|%s|", sth); 1402 1402 … … 1455 1455 mr_free(new_with_pipe); 1456 1456 mr_free(skip_these); 1457 mr_free(dir);1458 1457 1459 1458 if (dip) { … … 1583 1582 if ((include_paths != NULL) && (strlen(include_paths) == 0)) { 1584 1583 log_msg(1, "Including only '/' in %s", sz_filelist); 1585 open_and_list_dir("/", exclude_paths, fout, 1586 time_of_last_full_backup); 1584 open_and_list_dir("/", exclude_paths, fout, time_of_last_full_backup); 1587 1585 } else { 1588 1586 p = include_paths; … … 1590 1588 q = next_entry(p); 1591 1589 log_msg(1, "Including %s in filelist %s", q, sz_filelist); 1592 open_and_list_dir(q, exclude_paths, fout, 1593 time_of_last_full_backup); 1590 open_and_list_dir(q, exclude_paths, fout, time_of_last_full_backup); 1594 1591 p += strlen(q); 1595 1592 paranoid_free(q); … … 1652 1649 1653 1650 if (bkpinfo->make_filelist) { 1654 res = 1655 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, 1656 bkpinfo->scratchdir, bkpinfo->include_paths, 1657 bkpinfo->exclude_paths, 1658 bkpinfo->differential, NULL); 1651 res = mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, bkpinfo->scratchdir, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL); 1659 1652 } else { 1660 res = 1661 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, 1662 bkpinfo->scratchdir, NULL, 1663 bkpinfo->exclude_paths, 1664 bkpinfo->differential, 1665 bkpinfo->include_paths); 1653 res = mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, bkpinfo->scratchdir, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths); 1666 1654 } 1667 1655 -
branches/3.2/mondo/src/common/libmondo-fork.c
r3195 r3205 51 51 assert_string_is_neither_NULL_nor_zerolength(call); 52 52 if ((fin = popen(call, "r"))) { 53 for (mr_getline(tmp, fin); !feof(fin); mr_getline(tmp, fin)) { 53 while (!feof(fin)) { 54 mr_getline(tmp, fin); 54 55 if (strlen(tmp) > 1) { 55 56 strcpy(result, tmp); … … 62 63 } 63 64 strip_spaces(result); 64 mr_free(tmp);65 65 return(result); 66 66 } -
branches/3.2/mondo/src/common/libmondo-string.c
r3194 r3205 92 92 for (p = in_out; *p == ' '; p++); 93 93 strcpy(scratch, p); 94 strip_spaces 94 strip_spaces(scratch); 95 95 len = (int) strlen(scratch); 96 96 mid = width / 2; -
branches/3.2/mondo/src/common/libmondo-tools.c
r3195 r3205 366 366 assert(bkpinfo != NULL); 367 367 368 bkpinfo->optimal_set_size = 369 (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * 370 1024; 368 bkpinfo->optimal_set_size = (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * 1024; 371 369 372 370 log_msg(1, "Post-param"); … … 383 381 if (run_program_and_log_output(tmp, 3)) { 384 382 mr_free(tmp); 385 fatal_error 386 ("Unable to open tape device. If you haven't specified it with -d, do so. If you already have, check your parameter. I think it's wrong."); 383 fatal_error("Unable to open tape device. If you haven't specified it with -d, do so. If you already have, check your parameter. I think it's wrong."); 387 384 } 388 385 mr_free(tmp); … … 451 448 // -m isn't supported by growisofs, BTW... 452 449 } else { 453 sprintf(bkpinfo->call_make_iso, 454 "%s %s -Z %s . 2>> _ERR_", 455 mondo_mkisofs_sz, 456 "", bkpinfo->media_device); 450 sprintf(bkpinfo->call_make_iso, "%s %s -Z %s . 2>> _ERR_", mondo_mkisofs_sz, "", bkpinfo->media_device); 457 451 } 458 452 mr_free(mondo_mkisofs_sz); … … 519 513 if (bkpinfo->manual_cd_tray) { 520 514 if (bkpinfo->call_before_iso[0] == '\0') { 521 sprintf(bkpinfo->call_before_iso, 522 "%s -o %s/"MONDO_TMPISOS" . 2>> _ERR_", 523 mondo_mkisofs_sz, bkpinfo->tmpdir); 524 } else { 515 sprintf(bkpinfo->call_before_iso, "%s -o %s/"MONDO_TMPISOS" . 2>> _ERR_", mondo_mkisofs_sz, bkpinfo->tmpdir); 516 } else { 525 517 mr_asprintf(call_before_iso_user, "%s", bkpinfo->call_before_iso); 526 518 sprintf(bkpinfo->call_before_iso, "( %s -o %s/"MONDO_TMPISOS" . 2>> _ERR_ ; %s )", mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user); … … 1058 1050 return (0); 1059 1051 } else { 1060 mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", 1061 label, config_file); 1052 mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file); 1062 1053 strcpy(value, call_program_and_get_last_line_of_output(command)); 1063 1054 mr_free(command); -
branches/3.2/mondo/src/common/newt-specific.c
r3194 r3205 417 417 mr_free(bkpinfo->netfs_user); 418 418 mr_free(bkpinfo->netfs_proto); 419 mr_free(bkpinfo->netfs_remotedir); 419 420 mr_free(bkpinfo->exclude_devs); 420 421 mr_free(bkpinfo->exclude_paths); … … 650 651 assert(b3 != NULL); 651 652 652 mr_asprintf(blurb1, 653 mr_asprintf(blurb2, 654 mr_asprintf(blurb3, 653 mr_asprintf(blurb1, "%s", b1); 654 mr_asprintf(blurb2, "%s", b2); 655 mr_asprintf(blurb3, "%s", b3); 655 656 656 657 strcpy(b1c, b1); … … 964 965 } 965 966 g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; 966 if ((percentage < 3 && g_isoform_old_progress < 3) 967 || percentage > g_isoform_old_progress) { 967 if ((percentage < 3 && g_isoform_old_progress < 3) || percentage > g_isoform_old_progress) { 968 968 g_isoform_old_progress = percentage; 969 969 mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60); -
branches/3.2/mondo/src/lib/mr_mem.c
r3185 r3205 74 74 size_t n = 0; 75 75 76 /* We reached end of file, allocating empty string */ 77 if (feof(fd)) { 78 mr_asprintf_int(lineptr, line, file, ""); 79 return; 80 } 76 81 ret = getline(lineptr,&n,fd); 77 if ( (ret == -1) && (! feof(fd))) {82 if (ret == -1) { 78 83 mr_msg_int(1,line,file,"Unable to alloc memory in mr_getline\nExiting..."); 79 84 mr_exit(-1,"Unable to alloc memory in mr_getline"); 80 }81 /* We reached end of file, allocating empty string */82 if (ret == -1) {83 mr_asprintf_int(lineptr, line, file, "");84 85 } 85 86 } -
branches/3.2/mondo/src/mondorestore/mondo-rstr-tools.c
r3194 r3205 868 868 mr_asprintf(bkpinfo->netfs_mount, "%s", value); 869 869 870 read_cfg_var(g_mondo_cfg_file, "netfs-server-path", 870 read_cfg_var(g_mondo_cfg_file, "netfs-server-path", value); 871 871 mr_free(bkpinfo->netfs_remote_dir); 872 872 mr_asprintf(bkpinfo->netfs_remote_dir, "%s", value);
Note:
See TracChangeset
for help on using the changeset viewer.