Changeset 2290 in MondoRescue for branches/2.2.9/mondo/src
- Timestamp:
- Jul 22, 2009, 2:03:44 PM (16 years ago)
- Location:
- branches/2.2.9/mondo/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/libmondo-archive.c
r2285 r2290 226 226 log_msg(5, "command='%s'", command); 227 227 res = system(command); 228 mr_asprintf(&tmp, last_line_of_file(MONDO_LOGFILE));228 mr_asprintf(&tmp, "%s", last_line_of_file(MONDO_LOGFILE)); 229 229 log_msg(1, "res=%d; tmp='%s'", res, tmp); 230 230 if (bkpinfo->use_star && (res == 254 || res == 65024) … … 541 541 542 542 assert(bkpinfo != NULL); 543 mr_asprintf(&tmp, 544 "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", 543 mr_asprintf(&tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", 545 544 bkpinfo->exclude_paths); 546 545 mr_asprintf(&devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp)); … … 624 623 625 624 #ifdef __FreeBSD__ 626 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output625 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 627 626 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 628 627 if (!bootdev[0]) { 629 628 mr_free(bootdev); 630 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output629 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 631 630 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 632 631 } … … 634 633 /* Linux */ 635 634 #ifdef __IA64__ 636 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output635 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 637 636 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 638 637 #else 639 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output638 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 640 639 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 641 640 #endif … … 643 642 mr_free(bootdev); 644 643 #ifdef __IA64__ 645 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output644 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 646 645 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 647 646 #else 648 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output647 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 649 648 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 650 649 #endif … … 652 651 if (!bootdev[0]) { 653 652 mr_free(bootdev); 654 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output653 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 655 654 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 656 655 if (strstr(bootdev, "/dev/cciss/")) { 657 656 mr_free(bootdev); 658 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output657 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output 659 658 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 660 659 } … … 667 666 ch = 'U'; 668 667 if (bkpinfo->boot_loader != '\0') { 669 mr_asprintf(&tmp, "User specified boot loader. It is '%c'.", 670 bkpinfo->boot_loader); 668 mr_asprintf(&tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader); 671 669 log_msg(2, tmp); 672 670 mr_free(tmp); … … 675 673 } 676 674 if (bkpinfo->boot_device[0] != '\0') { 677 mr_asprintf(&tmp, "User specified boot device. It is '%s'.", 678 bkpinfo->boot_device); 675 mr_asprintf(&tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device); 679 676 log_msg(2, tmp); 680 677 mr_free(tmp); … … 761 758 mr_asprintf(&bootldr_str, "unknown"); 762 759 } 763 mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s", 764 bootldr_str, bkpinfo->boot_device); 760 mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 765 761 log_to_screen(tmp); 766 762 mr_free(tmp); … … 862 858 estimated_total_noof_slices = 863 859 size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 864 /* add nfs stuff here? */860 /* add nfs stuff here? */ 865 861 mr_asprintf(&command, "mkdir -p %s/images", bkpinfo->scratchdir); 866 862 if (system(command)) { … … 1509 1505 mr_free(media_usage_comment); 1510 1506 if (res) { 1511 mr_asprintf(&tmp, 1512 "Failed to add archive %ld's files to CD dir\n", 1507 mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", 1513 1508 storing_set_no); 1514 1509 log_to_screen(tmp); … … 1796 1791 } 1797 1792 pause_for_N_seconds(5, "Letting DVD drive settle"); 1798 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", 1799 bkpinfo->media_device); 1793 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device); 1800 1794 log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk); 1801 1795 res = … … 1985 1979 bool ret = TRUE; 1986 1980 1987 mr_asprintf(&command, 1988 "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", 1989 bigfile_fname); 1981 mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname); 1990 1982 log_msg(1, "command = '%s'", command); 1991 1983 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); … … 2106 2098 "Calling ntfsclone in background because %s is an NTFS partition", 2107 2099 bigfile_fname); 2108 mr_asprintf(&sz_devfile, "%s/%d.%d.000", 2109 bkpinfo->tmpdir, 2100 mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, 2110 2101 (int) (random() % 32768), 2111 2102 (int) (random() % 32768)); … … 2234 2225 log_msg(1, "EXAT'g set %ld", curr_set_no); 2235 2226 if (g_getfattr) { 2236 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 2237 bkpinfo->tmpdir, curr_set_no); 2227 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2238 2228 get_fattr_list(curr_filelist_fname, curr_xattr_list_fname); 2239 2229 } 2240 2230 if (g_getfacl) { 2241 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 2242 bkpinfo->tmpdir, curr_set_no); 2231 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2243 2232 get_acl_list(curr_filelist_fname, curr_acl_list_fname); 2244 2233 } … … 2250 2239 retval += res; 2251 2240 if (res) { 2252 mr_asprintf(&tmp, 2253 "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", 2254 curr_set_no); 2241 mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no); 2255 2242 log_to_screen(tmp); 2256 2243 mr_free(tmp); … … 2304 2291 2305 2292 if (res) { 2306 mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", 2307 curr_set_no); 2293 mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no); 2308 2294 log_to_screen(tmp); 2309 2295 mr_free(tmp); … … 2514 2500 continue; 2515 2501 } 2516 mr_asprintf(&curr_file, cf);2502 mr_asprintf(&curr_file, "%s", cf); 2517 2503 if (!does_file_exist(curr_file)) { 2518 2504 log_msg(1, … … 2543 2529 continue; 2544 2530 } 2545 mr_asprintf(&curr_file, cf);2531 mr_asprintf(&curr_file, "%s", cf); 2546 2532 2547 2533 mr_asprintf(&tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir); … … 2618 2604 continue; 2619 2605 } 2620 mr_asprintf(&curr_file, cf);2606 mr_asprintf(&curr_file, "%s", cf); 2621 2607 if (!does_file_exist(curr_file)) { 2622 2608 log_msg(1, … … 2676 2662 char *cdrecord = NULL; 2677 2663 2678 mr_asprintf(&bkp, cdrw_dev);2664 mr_asprintf(&bkp, "%s", cdrw_dev); 2679 2665 if (find_cdrw_device(cdrw_dev)) { 2680 2666 strcpy(cdrw_dev, bkp); … … 2835 2821 eject_device(cdrom_dev); 2836 2822 mds = media_descriptor_string(g_backup_media_type); 2837 mr_asprintf(&tmp, 2838 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", 2823 mr_asprintf(&tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", 2839 2824 mds, g_current_media_number, mds); 2840 2825 mr_free(mds); … … 3004 2989 mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 3005 2990 log_it("command = %s", command); 3006 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2991 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 3007 2992 mr_free(command); 3008 2993 log_it("res of it = %s", tmp); … … 3037 3022 strcpy(biggiestruct.checksum, checksum_line); 3038 3023 3039 mr_asprintf(&tmp, slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));3024 mr_asprintf(&tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, "")); 3040 3025 fout = fopen(tmp, "w"); 3041 3026 if (fout == NULL) { … … 3078 3063 } 3079 3064 for (slice_num = 1; !finished; slice_num++) { 3080 mr_asprintf(&curr_slice_fname_uncompressed, "%s", 3081 slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, 3082 "")); 3083 mr_asprintf(&curr_slice_fname_compressed, "%s", 3084 slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, 3085 suffix)); 3086 3087 mr_asprintf(&tmp, percent_media_full_comment()); 3065 mr_asprintf(&curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, "")); 3066 mr_asprintf(&curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix)); 3067 3068 mr_asprintf(&tmp, "%s", percent_media_full_comment()); 3088 3069 update_progress_form(tmp); 3089 3070 paranoid_free(tmp); … … 3117 3098 } 3118 3099 if (should_I_compress_slices && bkpinfo->compression_level > 0) { 3119 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, 3120 bkpinfo->compression_level, 3121 curr_slice_fname_uncompressed); 3100 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed); 3122 3101 log_msg(2, command); 3123 3102 if ((res = system(command))) { … … 3126 3105 // did_I_compress_slice = TRUE; 3127 3106 } else { 3128 mr_asprintf(&command, "mv %s %s 2>> %s", 3129 curr_slice_fname_uncompressed, 3130 curr_slice_fname_compressed, MONDO_LOGFILE); 3107 mr_asprintf(&command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE); 3131 3108 res = 0; // don't do it :) 3132 3109 // did_I_compress_slice = FALSE; … … 3146 3123 mr_asprintf(&tmp, "Problem with slice # %ld", slice_num); 3147 3124 } else { 3148 mr_asprintf(&tmp, 3149 "%s - Bigfile #%ld, slice #%ld compressed OK ", 3150 biggie_filename, biggie_file_number + 1, 3125 mr_asprintf(&tmp, "%s - Bigfile #%ld, slice #%ld compressed OK ", biggie_filename, biggie_file_number + 1, 3151 3126 slice_num); 3152 3127 } … … 3163 3138 paranoid_free(tmp); 3164 3139 3165 mr_asprintf(&file_to_archive, curr_slice_fname_compressed);3140 mr_asprintf(&file_to_archive, "%s", curr_slice_fname_compressed); 3166 3141 g_current_progress++; 3167 3142 } else { /* if i==0 then ... */ 3168 3143 3169 3144 finished = TRUE; 3170 mr_asprintf(&file_to_archive, curr_slice_fname_uncompressed);3145 mr_asprintf(&file_to_archive, "%s", curr_slice_fname_uncompressed); 3171 3146 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 3172 3147 break; … … 3189 3164 retval += res; 3190 3165 if (res) { 3191 mr_asprintf(&tmp, 3192 "Failed to add slice %ld of bigfile %ld to scratchdir", 3193 slice_num, biggie_file_number + 1); 3166 mr_asprintf(&tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1); 3194 3167 log_to_screen(tmp); 3195 3168 paranoid_free(tmp); … … 3532 3505 if (res) { 3533 3506 mds = media_descriptor_string(bkpinfo->backup_media_type); 3534 mr_asprintf(&tmp, 3535 "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number); 3507 mr_asprintf(&tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number); 3536 3508 mr_free(mds); 3537 3509 log_to_screen(tmp); … … 3540 3512 } 3541 3513 } 3542 mr_asprintf(&tmp, 3543 "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", 3544 MONDO_LOGFILE, MONDO_CACHE); 3514 mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE); 3545 3515 (void)system(tmp); 3546 3516 mr_free(tmp); 3547 3517 3548 mr_asprintf(&tmp, 3549 "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", 3550 MONDO_LOGFILE, MONDO_CACHE); 3518 mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE); 3551 3519 (void)system(tmp); 3552 3520 mr_free(tmp); -
branches/2.2.9/mondo/src/common/libmondo-cli.c
r2241 r2290 362 362 363 363 log_msg(5, "dsf: %s", dsf); 364 364 365 365 /******** 366 366 * See if a device special file was passed in (i.e. it must start with /dev/ … … 386 386 } 387 387 log_msg(5, " %s device special file exists", dsf); 388 388 389 389 /* Get a list of the mounted file systems */ 390 390 if (create_list_of_non_NFS_mounted_file_systems()) { … … 398 398 * Either way, it's an error. 399 399 ********/ 400 mr_asprintf(&command, 401 "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 400 mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 402 401 log_msg(4, "Executing: %s", command); 403 402 mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command)); … … 452 451 log_msg(4, "Processing partition: %s", partitions[i]); 453 452 /* See if it's swap. If it is, ignore it. */ 454 mr_asprintf(&command, 455 "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", 453 mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", 456 454 dsf, partitions[i]); 457 455 log_msg(4, " Running: %s", command); … … 490 488 if (strlen(tmp)) { 491 489 log_msg(4, " Partition ID: %s", tmp); 492 if (!strcasecmp(tmp, "8e")) { 490 if (!strcasecmp(tmp, "8e")) { 493 491 /* It's LVM: Find the VG it's in */ 494 492 log_msg(4, " It's LVM: Find the VG it's in..."); … … 501 499 /* Found the Volume Group. Now find all of the VG's mount points */ 502 500 log_msg(4, " Found the Volume Group. Now find all of the VG's mount points"); 503 mr_asprintf(&command, 504 "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", 505 VG, VG); 501 mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 506 502 log_msg(4, " Running: %s", command); 507 503 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command)); … … 525 521 *******/ 526 522 paranoid_free(mount_list); 527 mr_asprintf(&command, "%s", 528 "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 523 mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 529 524 log_msg (5, "Running: %s", command); 530 525 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command)); 531 526 paranoid_free(command); 532 log_msg(4, " Software raid device list: %s", mount_list); 527 log_msg(4, " Software raid device list: %s", mount_list); 533 528 lastpos = 0; 534 529 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 535 mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 530 mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 536 531 log_msg (5, "Running: %s", command); 537 532 paranoid_free(tmp); … … 579 574 log_msg (5, " UUID: %s", tmp); 580 575 /* Get the Software raid device list */ 581 mr_asprintf(&command, "%s", 582 "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 576 mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 583 577 log_msg (5, " Running: %s", command); 584 578 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command)); 585 579 paranoid_free(command); 586 log_msg(4, " Software raid device list: %s", mount_list); 580 log_msg(4, " Software raid device list: %s", mount_list); 587 581 /* Loop through the software raid device list to see if we can find the partition */ 588 582 lastpos = 0; … … 767 761 strcat(bkpinfo->include_paths, " "); 768 762 } 769 763 770 764 mr_asprintf(&tmp1, "%s", flag_val['I']); 771 765 p = tmp1; … … 1514 1508 if (flag_set[opt]) { 1515 1509 bad_switches = TRUE; 1516 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, 1517 flag_val[opt]); 1510 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]); 1518 1511 log_to_screen(tmp); 1519 1512 paranoid_free(tmp); … … 1531 1524 if (strchr(flag_val[opt], '/') 1532 1525 && flag_val[opt][0] != '/') { 1533 mr_asprintf(&tmp, 1534 "-%c flag --- must be absolute path --- '%s' isn't absolute", 1535 opt, flag_val[opt]); 1526 mr_asprintf(&tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]); 1536 1527 log_to_screen(tmp); 1537 1528 paranoid_free(tmp); … … 1604 1595 case SIGABRT: 1605 1596 mr_asprintf(&tmp, "SIGABRT"); 1606 mr_asprintf(&tmp2, 1607 "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message."); 1597 mr_asprintf(&tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message."); 1608 1598 break; 1609 1599 default: -
branches/2.2.9/mondo/src/common/libmondo-devices.c
r2257 r2290 1148 1148 mr_free(device_with_space); 1149 1149 paranoid_pclose(fin); 1150 mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", 1151 SWAPLIST_COMMAND, device_with_space); 1150 mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space); 1152 1151 log_msg(4, "tmp (command) = '%s'", tmp); 1153 1152 if (!system(tmp)) { … … 1298 1297 1299 1298 #ifdef __FreeBSD__ 1300 mr_asprintf(&dev, make_vn(device));1299 mr_asprintf(&dev, "%s", make_vn(device)); 1301 1300 if (!dev) { 1302 1301 mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device); … … 1315 1314 1316 1315 #ifdef __FreeBSD__ 1317 mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", 1318 device, mountpoint, MONDO_LOGFILE); 1316 mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1319 1317 1320 1318 #else 1321 mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", 1322 device, options, mountpoint, MONDO_LOGFILE); 1319 mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE); 1323 1320 paranoid_free(options); 1324 1321 #endif … … 1608 1605 if (bkpinfo->media_device[0]) { 1609 1606 if (bkpinfo->backup_media_type == usb) { 1610 mr_asprintf(&tmp, 1611 "I think your %s media corresponds to %s. Is this correct?", mds, 1612 bkpinfo->media_device); 1607 mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device); 1613 1608 } else { 1614 mr_asprintf(&tmp, 1615 "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, 1616 bkpinfo->media_device); 1609 mr_asprintf(&tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device); 1617 1610 } 1618 1611 if (!ask_me_yes_or_no(tmp)) { … … 1682 1675 } 1683 1676 if (bkpinfo->media_device[0]) { 1684 mr_asprintf(&tmp, 1685 "I think I've found your tape streamer at %s; am I right on the money?", 1686 bkpinfo->media_device); 1677 mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device); 1687 1678 if (!ask_me_yes_or_no(tmp)) { 1688 1679 bkpinfo->media_device[0] = '\0'; … … 1811 1802 sprintf(command, "mkdir -p %s", bkpinfo->isodir); 1812 1803 run_program_and_log_output(command, 5); 1813 mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, 1814 bkpinfo->isodir); 1804 mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir); 1815 1805 run_program_and_log_output(tmp, 3); 1816 1806 mr_free(tmp); … … 1824 1814 finish(1); 1825 1815 } 1826 mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);1816 mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir); 1827 1817 if (!popup_and_get_string 1828 1818 ("Directory", "Which directory within that mountpoint?", tmp, … … 1976 1966 mr_free(tmp); 1977 1967 // NTFS 1978 mr_asprintf(&tmp, "%s", 1979 call_program_and_get_last_line_of_output 1980 ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1968 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1981 1969 if (strlen(tmp) > 2) { 1982 1970 if (!popup_and_get_string … … 2106 2094 2107 2095 mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only()); 2108 mr_asprintf(&exclude_these_devices,"%s", 2109 call_program_and_get_last_line_of_output 2110 ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2096 mr_asprintf(&exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2111 2097 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2112 2098 mr_free(exclude_these_devices); … … 2129 2115 static char result_sz[512]; 2130 2116 2131 mr_asprintf(&exclude_these_directories,"%s", 2132 call_program_and_get_last_line_of_output 2133 ("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2117 mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2134 2118 snprintf(result_sz, 511, "%s", exclude_these_directories); 2135 2119 mr_free(exclude_these_directories); … … 2186 2170 2187 2171 #ifdef __FreeBSD__ 2188 mr_asprintf(&tmp, 2189 call_program_and_get_last_line_of_output 2190 ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2172 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2191 2173 #else 2192 mr_asprintf(&tmp, 2193 call_program_and_get_last_line_of_output 2194 ("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2174 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2195 2175 #endif 2196 2176 2197 2177 if (tmp[0] != '/') { 2198 mr_asprintf(&sz, tmp);2178 mr_asprintf(&sz, "%s", tmp); 2199 2179 paranoid_free(tmp); 2200 2180 mr_asprintf(&tmp, "/%s", sz); … … 2294 2274 } 2295 2275 2296 mr_asprintf(&mountdev, bkpinfo->media_device);2276 mr_asprintf(&mountdev, "%s", bkpinfo->media_device); 2297 2277 if (!mountdev[0]) { 2298 2278 log_it … … 2427 2407 assert(which_device != NULL); 2428 2408 2429 mr_asprintf(&list_drives_cmd, 2430 "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", 2431 where_is_root_mounted()); 2409 mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted()); 2432 2410 log_it("list_drives_cmd = %s", list_drives_cmd); 2433 2411 … … 2471 2449 } else { 2472 2450 // We need to look on each partition then 2473 mr_asprintf(&list_drives_cmd, 2474 "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2451 mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2475 2452 log_it("list_drives_cmd = %s", list_drives_cmd); 2476 2453 … … 2575 2552 log_msg(1, "curr_fname = %s", curr_fname); 2576 2553 sprintf(command, "file %s", curr_fname); 2577 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2554 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 2578 2555 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 2579 2556 p--); 2580 2557 p++; 2581 mr_asprintf(&scratch, p);2558 mr_asprintf(&scratch, "%s", p); 2582 2559 for (p = scratch; *p != '\0' && *p != '\''; p++); 2583 2560 *p = '\0'; … … 2629 2606 log_msg(1, "Using %s", fdisk); 2630 2607 sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive); 2631 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2608 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 2632 2609 if (strstr(tmp, "GPT") == NULL) { 2633 2610 strcpy(output, "MBR"); -
branches/2.2.9/mondo/src/common/libmondo-fifo.c
r2217 r2290 166 166 } 167 167 paranoid_system("sync"); 168 mr_asprintf(&command, 169 "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer); 168 mr_asprintf(&command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer); 170 169 log_msg(2, "kill_buffer() --- command = %s", command); 171 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));170 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 172 171 mr_free(command); 173 172 -
branches/2.2.9/mondo/src/common/libmondo-filelist.c
r2241 r2290 1401 1401 #if linux 1402 1402 // 2.6 has /sys as a proc-type thing -- must be excluded 1403 mr_asprintf(&strtmp, 1404 "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", 1405 dir, find_excludes, g_skeleton_filelist); 1403 mr_asprintf(&strtmp, "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist); 1406 1404 #else 1407 1405 // On BSD, for example, /sys is the kernel sources -- don't exclude 1408 mr_asprintf(&strtmp, 1409 "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", 1410 dir, find_excludes, g_skeleton_filelist); 1406 mr_asprintf(&strtmp, "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist); 1411 1407 #endif 1412 1408 paranoid_free(find_excludes); … … 1498 1494 counter = 0; 1499 1495 uberctr++; 1500 mr_asprintf(&tmp, " %c ", 1501 special_dot_char(uberctr)); 1496 mr_asprintf(&tmp, " %c ", special_dot_char(uberctr)); 1502 1497 #ifndef _XWIN 1503 1498 if (!g_text_mode) { -
branches/2.2.9/mondo/src/common/libmondo-mountlist.c
r2237 r2290 532 532 (drivelist->el[i].device, 533 533 DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) { 534 mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", 535 drivelist->el[i].device); 534 mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device); 536 535 log_it(tmp); 537 536 paranoid_free(tmp); … … 622 621 if (copies > 1 && last_copy == currline 623 622 && strcmp(curr_mountpoint, "raid")) { 624 mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), 625 curr_mountpoint); 623 mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), curr_mountpoint); 626 624 mr_strcat(flaws_str, "%s", tmp); 627 625 log_it(tmp); … … 749 747 (void *) &mountlist->el[i], 750 748 sizeof(struct mountlist_line)); 751 mr_asprintf(&tmp, 752 "%s is available; user may choose to add it to raid device", 753 output_list->el[items - 1].device); 749 mr_asprintf(&tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device); 754 750 log_it(tmp); 755 751 paranoid_free(tmp); … … 869 865 if (j < items) { 870 866 strcat(mountlist->el[items].device, "_dup"); 871 mr_asprintf(&tmp, 872 "Duplicate entry in mountlist - renaming to %s", 873 mountlist->el[items].device); 867 mr_asprintf(&tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device); 874 868 log_it(tmp); 875 869 paranoid_free(tmp); -
branches/2.2.9/mondo/src/common/libmondo-tools.c
r2241 r2290 684 684 retval++; 685 685 } else { 686 mr_asprintf(&ip_address, inet_ntoa 687 ((struct in_addr) 688 *((struct in_addr *) hent->h_addr))); 686 mr_asprintf(&ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr))); 689 687 mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':')); 690 688 strcpy(bkpinfo->nfs_mount, ip_address); -
branches/2.2.9/mondo/src/common/newt-specific.c
r2241 r2290 224 224 newtFormDestroy(g_isoform_main); 225 225 newtPopWindow(); 226 227 /* Reset globals */ 226 228 g_isoform_main = NULL; 227 229 g_isoform_old_progress = -1; 228 } 229 230 g_isoform_header = NULL; 231 g_isoform_scale = NULL; 232 g_isoform_timeline = NULL; 233 g_isoform_pcline = NULL; 234 } 230 235 231 236 /** … … 252 257 newtFormDestroy(g_progressForm); 253 258 newtPopWindow(); 259 260 /* Reset globals */ 254 261 g_progressForm = NULL; 255 262 g_current_progress = -999; 263 g_timeline = NULL; 264 g_percentline = NULL; 265 g_scale = NULL; 266 256 267 } 257 268 … … 288 299 char *command; 289 300 static bool already_exiting = FALSE; 290 int i;291 301 292 302 /*@ end vars **************************************************** */ -
branches/2.2.9/mondo/src/lib/mr_conf.c
r1594 r2290 108 108 CONF = fopen(filename, "r"); 109 109 110 mr_asprintf(&mr_conf_filename, filename);110 mr_asprintf(&mr_conf_filename, "%s", filename); 111 111 112 112 /*if file is empty or not exist => error */ … … 232 232 return(p); 233 233 } 234 mr_asprintf(&q, p);234 mr_asprintf(&q, "%s", p); 235 235 236 236 if (*p != '"') { -
branches/2.2.9/mondo/src/mondoarchive/mondoarchive.c
r2241 r2290 364 364 retval += res; 365 365 if (res) { 366 mr_asprintf(&say_at_end, 367 "Data archived. Please check the logs, just as a precaution. "); 366 mr_asprintf(&say_at_end, "Data archived. Please check the logs, just as a precaution. "); 368 367 } else { 369 368 mr_asprintf(&say_at_end, "Data archived OK. "); … … 377 376 mr_asprintf(&tmp, "%d difference%c found.", -res, 378 377 (-res != 1) ? 's' : ' '); 379 mr_asprintf(&say_at_end, tmp);378 mr_asprintf(&say_at_end, "%s", tmp); 380 379 log_to_screen(tmp); 381 380 mr_free(tmp); -
branches/2.2.9/mondo/src/mondorestore/mondo-prep.c
r2230 r2290 612 612 // - faulty devices ignored 613 613 // - persistent superblock always used as this is recommended 614 mr_asprintf(&program, 615 "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", 616 raidlist->el[i].raid_device, level, 617 raidlist->el[i].data_disks.entries); 614 mr_asprintf(&program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries); 618 615 if (raidlist->el[i].parity != -1) { 619 616 mr_asprintf(&strtmp, "%s", program); … … 710 707 #endif 711 708 if (strlen(format) <= 2) { 712 mr_asprintf(&tmp, 713 "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", 714 device, format); 709 mr_asprintf(&tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format); 715 710 log_it(tmp); 716 711 paranoid_free(tmp); … … 777 772 778 773 while (1) { 779 mr_asprintf(&tmp, 780 "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", 781 line); 774 mr_asprintf(&tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line); 782 775 FILE *pin = popen(tmp, "r"); 783 776 paranoid_free(tmp); -
branches/2.2.9/mondo/src/mondorestore/mondo-rstr-compare.c
r2242 r2290 81 81 insist_on_this_cd_number((++g_current_media_number)); 82 82 } else { 83 mr_asprintf(&tmp_ptr, 84 "No CD's left. No biggiefiles left. No prob, Bob."); 83 mr_asprintf(&tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob."); 85 84 log_msg(2, tmp_ptr); 86 85 paranoid_free(tmp_ptr); … … 89 88 } 90 89 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) { 91 mr_asprintf(&tmp_ptr, 92 "Cannot open bigfile %ld (%s)'s info file", 93 bigfileno + 1, bigfile_fname_ptr); 90 mr_asprintf(&tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr); 94 91 log_to_screen(tmp_ptr); 95 92 paranoid_free(tmp_ptr); … … 148 145 } 149 146 } 150 mr_asprintf(&tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, 151 bigfile_fname_ptr); 147 mr_asprintf(&tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr); 152 148 if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) { 153 149 mr_strcat(tmp_ptr, " ... OK"); -
branches/2.2.9/mondo/src/mondorestore/mondorestore.c
r2242 r2290 1783 1783 // if (strstr(tarball_fname, ".star.")) 1784 1784 if (use_star) { 1785 mr_asprintf(&command, 1786 "star -x -force-remove -U " STAR_ACL_SZ 1787 " errctl= file=%s", tarball_fname); 1785 mr_asprintf(&command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname); 1788 1786 if (strstr(tarball_fname, ".bz2")) { 1789 1787 mr_strcat(command, " -bz"); … … 1791 1789 } else { 1792 1790 if (filelist_subset_fname[0] != '\0') { 1793 mr_asprintf(&command, 1794 "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", 1795 TAPE_BLOCK_SIZE, 1796 BUFSIZE, executable, filelist_subset_fname, 1797 // files_to_restore_this_time_fname, 1798 tarball_fname); 1791 mr_asprintf(&command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname); 1799 1792 } else { 1800 mr_asprintf(&command, 1801 "afio -i -b %ld -c %ld -M 8m %s %s", 1802 TAPE_BLOCK_SIZE, 1803 BUFSIZE, executable, tarball_fname); 1793 mr_asprintf(&command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1804 1794 } 1805 1795 }
Note:
See TracChangeset
for help on using the changeset viewer.