Changeset 2323


Ignore:
Timestamp:
Aug 18, 2009, 3:05:43 PM (10 years ago)
Author:
bruno
Message:

r3334@localhost: bruno | 2009-08-08 12:17:37 +0200

  • Change mr_asprintf interface to pass only the char * (makes bkpinfo usage more easy)
Location:
branches/2.2.10/mondo
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-archive.c

    r2322 r2323  
    202202
    203203    if (!does_file_exist(filelist)) {
    204         mr_asprintf(&tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
     204        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
    205205        log_to_screen(tmp);
    206206        paranoid_free(tmp);
     
    208208    }
    209209
    210     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     210    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    211211    if (system(tmp)) {
    212212        paranoid_free(tmp);
     
    215215    paranoid_free(tmp);
    216216
    217     mr_asprintf(&command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s",
     217    mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s",
    218218            filelist, fname);
    219219    if (bkpinfo->use_lzo) {
     
    229229        log_msg(5, "command='%s'", command);
    230230        res = system(command);
    231         mr_asprintf(&tmp, "%s", last_line_of_file(MONDO_LOGFILE));
     231        mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE));
    232232        log_msg(1, "res=%d; tmp='%s'", res, tmp);
    233233        if (bkpinfo->use_star && (res == 254 || res == 65024)
     
    309309
    310310    if (!does_file_exist(filelist)) {
    311         mr_asprintf(&tmp, "(archive_this_fileset) - filelist %s does not exist",
     311        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist",
    312312                filelist);
    313313        log_to_screen(tmp);
     
    315315        return (1);
    316316    }
    317     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     317    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    318318    if (system(tmp)) {
    319319        paranoid_free(tmp);
     
    324324
    325325    if (bkpinfo->compression_level > 0) {
    326         mr_asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home);
     326        mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    327327        //       -b %ld, TAPE_BLOCK_SIZE
    328         mr_asprintf(&zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
     328        mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
    329329                bkpinfo->compression_level);
    330330        if (does_file_exist(tmp)) {
     
    335335        paranoid_free(tmp);
    336336    } else {
    337         mr_asprintf(&zipparams, "");
     337        mr_asprintf(zipparams, "");
    338338    }
    339339
     
    346346        fatal_error("scratchdir not found");
    347347    }
    348     mr_asprintf(&command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,
     348    mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,
    349349            fname, bkpinfo->zip_suffix);
    350350    paranoid_system(command);
    351351    paranoid_free(command);
    352352
    353     mr_asprintf(&command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
     353    mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
    354354    paranoid_free(zipparams);
    355355
    356     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     356    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    357357    if (system(tmp)) {
    358358        paranoid_free(tmp);
     
    429429    }
    430430
    431     mr_asprintf(&tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);
     431    mr_asprintf(tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);
    432432    if (run_program_and_log_output(tmp, 2)) {
    433433        mr_free(tmp);
     
    436436    mr_free(tmp);
    437437
    438     mr_asprintf(&tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
     438    mr_asprintf(tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
    439439    if (run_program_and_log_output(tmp, 2)) {
    440440        mr_free(tmp);
     
    461461    }
    462462    retval += do_that_initial_phase();  // prepare
    463     mr_asprintf(&tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
     463    mr_asprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
    464464    run_program_and_log_output(tmp, 1);
    465465    mr_free(tmp);
     
    541541    assert(bkpinfo != NULL);
    542542    if (bkpinfo->exclude_paths) {
    543         mr_asprintf(&tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths);
    544         mr_asprintf(&devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));
     543        mr_asprintf(tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths);
     544        mr_asprintf(devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));
    545545        mr_free(tmp);
    546546
    547         mr_asprintf(&tmp, "devs_to_exclude = '%s'", devs_to_exclude);
     547        mr_asprintf(tmp, "devs_to_exclude = '%s'", devs_to_exclude);
    548548        log_msg(2, tmp);
    549549        mr_free(tmp);
     
    552552    mvaddstr_and_log_it(g_currentY, 0,
    553553                        "Calling MINDI to create boot+data disks");
    554     mr_asprintf(&tmp, "%s/filelist.full", bkpinfo->tmpdir);
     554    mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir);
    555555    if (!does_file_exist(tmp)) {
    556556        mr_free(tmp);
    557         mr_asprintf(&tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
     557        mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    558558        if (!does_file_exist(tmp)) {
    559559            fatal_error
     
    564564    mr_free(tmp);
    565565
    566     mr_asprintf(&tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    567     mr_asprintf(&last_filelist_number, "%s", last_line_of_file(tmp));
     566    mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
     567    mr_asprintf(last_filelist_number, "%s", last_line_of_file(tmp));
    568568    mr_free(tmp);
    569569
    570570    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    571         mr_asprintf(&tape_size_sz, "%ld", bkpinfo->media_size[1]);
     571        mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size[1]);
    572572        ntapedev = get_non_rewind_dev(bkpinfo->media_device);
    573573        if ((bkpinfo->use_obdr) && (ntapedev != NULL)) {
     
    579579        }
    580580        paranoid_free(ntapedev);
    581         mr_asprintf(&tape_device, "%s", bkpinfo->media_device);
     581        mr_asprintf(tape_device, "%s", bkpinfo->media_device);
    582582    } else {
    583         mr_asprintf(&tape_size_sz, "%ld", 0L);;
    584         mr_asprintf(&tape_device, "");
     583        mr_asprintf(tape_size_sz, "%ld", 0L);;
     584        mr_asprintf(tape_device, "");
    585585    }
    586586    if (bkpinfo->use_lzo) {
    587         mr_asprintf(&use_lzo_sz, "yes");
     587        mr_asprintf(use_lzo_sz, "yes");
    588588    } else {
    589         mr_asprintf(&use_lzo_sz, "no");
     589        mr_asprintf(use_lzo_sz, "no");
    590590    }
    591591    if (bkpinfo->use_gzip) {
    592         mr_asprintf(&use_gzip_sz, "yes");
     592        mr_asprintf(use_gzip_sz, "yes");
    593593    } else {
    594         mr_asprintf(&use_gzip_sz, "no");
     594        mr_asprintf(use_gzip_sz, "no");
    595595    }
    596596    if (bkpinfo->use_star) {
    597         mr_asprintf(&use_star_sz, "yes");
     597        mr_asprintf(use_star_sz, "yes");
    598598    } else {
    599         mr_asprintf(&use_star_sz, "no");
     599        mr_asprintf(use_star_sz, "no");
    600600    }
    601601
    602602    if (bkpinfo->compression_level > 0) {
    603         mr_asprintf(&use_comp_sz, "yes");
     603        mr_asprintf(use_comp_sz, "yes");
    604604    } else {
    605         mr_asprintf(&use_comp_sz, "no");
    606     }
    607 
    608     mr_asprintf(&broken_bios_sz, "yes");    /* assume so */
     605        mr_asprintf(use_comp_sz, "no");
     606    }
     607
     608    mr_asprintf(broken_bios_sz, "yes"); /* assume so */
    609609    if (g_cd_recovery) {
    610         mr_asprintf(&cd_recovery_sz, "yes");
     610        mr_asprintf(cd_recovery_sz, "yes");
    611611    } else {
    612         mr_asprintf(&cd_recovery_sz, "no");
     612        mr_asprintf(cd_recovery_sz, "no");
    613613    }
    614614    if (bkpinfo->make_cd_use_lilo) {
    615         mr_asprintf(&use_lilo_sz, "yes");
     615        mr_asprintf(use_lilo_sz, "yes");
    616616    } else {
    617         mr_asprintf(&use_lilo_sz, "no");
     617        mr_asprintf(use_lilo_sz, "no");
    618618    }
    619619
     
    623623
    624624#ifdef __FreeBSD__
    625         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     625        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    626626               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    627627        if (!bootdev[0]) {
    628628            mr_free(bootdev);
    629             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     629            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    630630                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    631631        }
     
    633633        /* Linux */
    634634#ifdef __IA64__
    635         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     635        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    636636               ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    637637#else
    638         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     638        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    639639               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    640640#endif
     
    642642            mr_free(bootdev);
    643643#ifdef __IA64__
    644             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     644            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    645645                   ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    646646#else
    647             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     647            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    648648                   ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    649649#endif
     
    651651        if (!bootdev[0]) {
    652652            mr_free(bootdev);
    653             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     653            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    654654                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    655655            if (strstr(bootdev, "/dev/cciss/")) {
    656656                mr_free(bootdev);
    657                 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     657                mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    658658                       ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    659659            }
     
    666666            ch = 'U';
    667667        if (bkpinfo->boot_loader != '\0') {
    668             mr_asprintf(&tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
     668            mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
    669669            log_msg(2, tmp);
    670670            mr_free(tmp);
     
    673673        }
    674674        if (bkpinfo->boot_device[0] != '\0') {
    675             mr_asprintf(&tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
     675            mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
    676676            log_msg(2, tmp);
    677677            mr_free(tmp);
     
    696696    }
    697697    if (bkpinfo->boot_loader == 'L') {
    698         mr_asprintf(&bootldr_str, "LILO");
     698        mr_asprintf(bootldr_str, "LILO");
    699699        if (!does_file_exist("/etc/lilo.conf")) {
    700700            fatal_error
     
    702702        }
    703703    } else if (bkpinfo->boot_loader == 'G') {
    704         mr_asprintf(&bootldr_str, "GRUB");
     704        mr_asprintf(bootldr_str, "GRUB");
    705705        if (!does_file_exist("/boot/grub/menu.lst")
    706706            && does_file_exist("/boot/grub/grub.conf")) {
     
    713713        }
    714714    } else if (bkpinfo->boot_loader == 'E') {
    715         mr_asprintf(&bootldr_str, "ELILO");
     715        mr_asprintf(bootldr_str, "ELILO");
    716716        /* BCO: fix it for Debian, Mandrake, ... */
    717717        if (!does_file_exist("/etc/elilo.conf")
     
    744744        }
    745745    } else if (bkpinfo->boot_loader == 'R') {
    746         mr_asprintf(&bootldr_str, "RAW");
     746        mr_asprintf(bootldr_str, "RAW");
    747747    }
    748748#ifdef __FreeBSD__
    749749    else if (bkpinfo->boot_loader == 'D') {
    750         mr_asprintf(&bootldr_str, "DD");
     750        mr_asprintf(bootldr_str, "DD");
    751751    }
    752752
    753753    else if (bkpinfo->boot_loader == 'B') {
    754         mr_asprintf(&bootldr_str, "BOOT0");
     754        mr_asprintf(bootldr_str, "BOOT0");
    755755    }
    756756#endif
    757757    else {
    758         mr_asprintf(&bootldr_str, "unknown");
    759     }
    760     mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
     758        mr_asprintf(bootldr_str, "unknown");
     759    }
     760    mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    761761    log_to_screen(tmp);
    762762    mr_free(tmp);
    763763
    764     mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
     764    mr_asprintf(tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
    765765    if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) {
    766766        log_msg(1, "%ld: Unable to write one-liner boot device", __LINE__);
     
    770770    switch (bkpinfo->backup_media_type) {
    771771    case cdr:
    772         mr_asprintf(&value, "cdr");
     772        mr_asprintf(value, "cdr");
    773773        break;
    774774    case cdrw:
    775         mr_asprintf(&value, "cdrw");
     775        mr_asprintf(value, "cdrw");
    776776        break;
    777777    case cdstream:
    778         mr_asprintf(&value, "cdstream");
     778        mr_asprintf(value, "cdstream");
    779779        break;
    780780    case tape:
    781         mr_asprintf(&value, "tape");
     781        mr_asprintf(value, "tape");
    782782        break;
    783783    case udev:
    784         mr_asprintf(&value, "udev");
     784        mr_asprintf(value, "udev");
    785785        break;
    786786    case iso:
    787         mr_asprintf(&value, "iso");
     787        mr_asprintf(value, "iso");
    788788        break;
    789789    case nfs:
    790         mr_asprintf(&value, "nfs");
     790        mr_asprintf(value, "nfs");
    791791        break;
    792792    case dvd:
    793         mr_asprintf(&value, "dvd");
     793        mr_asprintf(value, "dvd");
    794794        break;
    795795    case usb:
    796         mr_asprintf(&value, "usb");
     796        mr_asprintf(value, "usb");
    797797        break;
    798798    default:
     
    800800    }
    801801    if (bkpinfo->backup_media_type == usb) {
    802         mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
     802        mr_asprintf(tmp2, "--usb %s", bkpinfo->media_device);
    803803    } else {
    804         mr_asprintf(&tmp2," ");
    805     }
    806 
    807     mr_asprintf(&tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
     804        mr_asprintf(tmp2," ");
     805    }
     806
     807    mr_asprintf(tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
    808808    if (write_one_liner_data_file(tmp, value)) {
    809809        res++;
     
    814814    mr_free(tmp);
    815815
    816     mr_asprintf(&tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
     816    mr_asprintf(tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
    817817    if (write_one_liner_data_file(tmp, bootldr_str)) {
    818818        res++;
     
    823823    mr_free(tmp);
    824824
    825     mr_asprintf(&tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
     825    mr_asprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
    826826    if (bkpinfo->differential) {
    827827        res += write_one_liner_data_file(tmp, "1");
     
    832832
    833833    if (g_getfattr) {
    834         mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
     834        mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir);
    835835        if (write_one_liner_data_file(tmp1, "TRUE")) {
    836836            log_msg(1, "%ld: Unable to write one-liner XATTR",
     
    840840    }
    841841    if (g_getfacl) {
    842         mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
     842        mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir);
    843843        if (write_one_liner_data_file(tmp1, "TRUE")) {
    844844            log_msg(1, "%ld: Unable to write one-liner ACL",
     
    848848    }
    849849    if (bkpinfo->use_obdr) {
    850         mr_asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     850        mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir);
    851851        if (write_one_liner_data_file(tmp1, "TRUE")) {
    852852            log_msg(1, "%ld: Unable to write one-liner OBDR",
     
    859859        size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    860860    /* add nfs stuff here? */
    861     mr_asprintf(&command, "mkdir -p %s/images", bkpinfo->scratchdir);
     861    mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir);
    862862    if (system(command)) {
    863863        res++;
     
    867867    log_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
    868868
    869 /*     "mindi 1=%s --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \
     869    mr_asprintf(command,
     870/*     "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \
    8708716=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \
    87187211=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
     
    919920    if (!res) {
    920921        log_to_screen("Boot+data disks were created OK");
    921         mr_asprintf(&command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE);
     922        mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE);
    922923        log_msg(2, command);
    923924        run_program_and_log_output(command, FALSE);
     
    925926
    926927        if (bkpinfo->nonbootable_backup) {
    927             mr_asprintf(&command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
     928            mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
    928929            if (system(command)) {
    929930                paranoid_free(command);
     
    934935        /* For USB we already have everything on the key */
    935936        if (bkpinfo->backup_media_type == usb) {
    936             mr_asprintf(&command, "rm -rf %s/images", bkpinfo->scratchdir);
     937            mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir);
    937938            run_program_and_log_output(command, FALSE);
    938939            paranoid_free(command);
    939940        } else {
    940             mr_asprintf(&tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
     941            mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
    941942            if (system(tmp)) {
    942943                fatal_error("Cannot find all.tar.gz in tmpdir");
     
    951952    } else {
    952953        log_to_screen("Mindi failed to create your boot+data disks.");
    953         mr_asprintf(&command, "grep 'Fatal error' /var/log/mindi.log");
    954         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     954        mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log");
     955        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    955956        paranoid_free(command);
    956957
     
    10581059        }
    10591060
    1060         mr_asprintf(&tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
     1061        mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
    10611062        if (does_file_exist(tmp)) {
    10621063            log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES,
     
    10721073                this_thread_no, archiving_set_no);
    10731074        if (g_getfattr) {
    1074             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1075            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    10751076            get_fattr_list(archiving_filelist_fname, curr_xattr_list_fname);
    10761077            mr_free(curr_xattr_list_fname);
    10771078        }
    10781079        if (g_getfacl) {
    1079             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1080            mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    10801081            get_acl_list(archiving_filelist_fname, curr_acl_list_fname);
    10811082            mr_free(curr_acl_list_fname);
     
    10911092
    10921093        if (res) {
    1093             mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
     1094            mr_asprintf(tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
    10941095            log_to_screen(tmp);
    10951096            mr_free(tmp);
     
    12091210
    12101211    assert(bkpinfo != NULL);
    1211     mr_asprintf(&data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);
    1212 
    1213     mr_asprintf(&g_serial_string, "%s", call_program_and_get_last_line_of_output("dd  if=/dev/urandom bs=16 count=1 2> /dev/null |  hexdump | tr -s ' ' '0' | head -n1"));
     1212    mr_asprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);
     1213
     1214    mr_asprintf(g_serial_string, "%s", call_program_and_get_last_line_of_output("dd  if=/dev/urandom bs=16 count=1 2> /dev/null |  hexdump | tr -s ' ' '0' | head -n1"));
    12141215    mr_strip_spaces(g_serial_string);
    12151216    mr_strcat(g_serial_string, "...word.");
    12161217    log_msg(2, "g_serial_string = '%s'", g_serial_string);
    12171218
    1218     mr_asprintf(&tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);
     1219    mr_asprintf(tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);
    12191220    if (write_one_liner_data_file(tmpfile, g_serial_string)) {
    12201221        log_msg(1, "%ld: Failed to write serial string", __LINE__);
     
    12431244    mr_free(data_disks_file);
    12441245
    1245     mr_asprintf(&command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
     1246    mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
    12461247    paranoid_system(command);
    12471248    mr_free(command);
     
    14091410            } else {
    14101411                // store set N
    1411                 mr_asprintf(&storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    1412                 mr_asprintf(&storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);
     1412                mr_asprintf(storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1413                mr_asprintf(storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);
    14131414                if (g_getfattr) {
    1414                     mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1415                    mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    14151416                }
    14161417                if (g_getfacl) {
    1417                     mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1418                    mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    14181419                }
    14191420
     
    14691470                mr_free(media_usage_comment);
    14701471                if (res) {
    1471                     mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no);
     1472                    mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no);
    14721473                    log_to_screen(tmp);
    14731474                    paranoid_free(tmp);
     
    14891490    close_progress_form();
    14901491
    1491     mr_asprintf(&tmp, "Your regular files have been archived ");
     1492    mr_asprintf(tmp, "Your regular files have been archived ");
    14921493    log_msg(2, "Joining background threads to foreground thread");
    14931494    for (i = 0; i < noof_threads; i++) {
     
    15551556    log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir);
    15561557    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1557     mr_asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
     1558    mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir);
    15581559    run_program_and_log_output(tmp, FALSE);
    15591560    paranoid_free(tmp);
     
    15611562
    15621563    mds = media_descriptor_string(bkpinfo->backup_media_type);
    1563     mr_asprintf(&message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
     1564    mr_asprintf(message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
    15641565    mr_free(mds);
    15651566    log_msg(1, message_to_screen);
    15661567
    1567     mr_asprintf(&tmp1, "%s1", bkpinfo->media_device);
     1568    mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
    15681569    if (is_this_device_mounted(tmp1)) {
    15691570        log_msg(1, "USB device mounted. Remounting it at the right place");
    1570         mr_asprintf(&tmp, "umount %s", tmp1);
     1571        mr_asprintf(tmp, "umount %s", tmp1);
    15711572        run_program_and_log_output(tmp, FALSE);
    15721573        paranoid_free(tmp);
     
    15751576
    15761577    log_msg(1, "Mounting USB device.");
    1577     mr_asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir);
    1578     mr_asprintf(&tmp, "mkdir -p %s", tmp1);
     1578    mr_asprintf(tmp1, "%s/usb", bkpinfo->tmpdir);
     1579    mr_asprintf(tmp, "mkdir -p %s", tmp1);
    15791580    run_program_and_log_output(tmp, FALSE);
    15801581    paranoid_free(tmp);
    15811582    /* Mindi always create one single parition on the USB dev */
    1582     mr_asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
     1583    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
    15831584    run_program_and_log_output(tmp, FALSE);
    15841585    paranoid_free(tmp);
     
    15901591
    15911592        /* Command to execute */
    1592         mr_asprintf(&tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
     1593        mr_asprintf(tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
    15931594        res = eval_call_to_make_USB(tmp, message_to_screen);
    15941595        if (res) {
    1595             mr_asprintf(&result_sz, "%s ...failed",tmp);
     1596            mr_asprintf(result_sz, "%s ...failed",tmp);
    15961597        } else {
    1597             mr_asprintf(&result_sz, "%s ...OK",tmp);
     1598            mr_asprintf(result_sz, "%s ...OK",tmp);
    15981599        }
    15991600        log_to_screen(result_sz);
     
    16031604
    16041605        /* Recreate the required structure under the scratch dir */
    1605         mr_asprintf(&tmp,"mkdir %s/archive", bkpinfo->scratchdir);
     1606        mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
    16061607        run_program_and_log_output(tmp, FALSE);
    16071608        paranoid_free(tmp);
     
    16111612
    16121613    if (is_this_device_mounted(bkpinfo->media_device)) {
    1613         mr_asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     1614        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    16141615        run_program_and_log_output(tmp, FALSE);
    16151616        paranoid_free(tmp);
     
    16651666    assert_string_is_neither_NULL_nor_zerolength(destfile);
    16661667
    1667     mr_asprintf(&tmp, "%s/isolinux.bin", bkpinfo->scratchdir);
    1668     mr_asprintf(&tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);
     1668    mr_asprintf(tmp, "%s/isolinux.bin", bkpinfo->scratchdir);
     1669    mr_asprintf(tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);
    16691670    if (does_file_exist(tmp)) {
    1670         mr_asprintf(&tmp3, "cp -f %s %s", tmp, tmp2);
     1671        mr_asprintf(tmp3, "cp -f %s %s", tmp, tmp2);
    16711672        paranoid_system(tmp3);
    16721673        mr_free(tmp3);
    16731674    }
    16741675    if (!does_file_exist(tmp) && does_file_exist(tmp2)) {
    1675         mr_asprintf(&tmp3, "cp -f %s %s", tmp2, tmp);
     1676        mr_asprintf(tmp3, "cp -f %s %s", tmp2, tmp);
    16761677        paranoid_system(tmp3);
    16771678        mr_free(tmp3);
     
    16861687    log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile);
    16871688    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1688     mr_asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
     1689    mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir);
    16891690    run_program_and_log_output(tmp, FALSE);
    16901691    mr_free(tmp);
     
    16931694
    16941695    if (bkpinfo->call_before_iso[0] != '\0') {
    1695         mr_asprintf(&message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
     1696        mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
    16961697        res =
    16971698            eval_call_to_make_ISO(bkpinfo->call_before_iso,
     
    17121713        log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso);
    17131714        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1714         mr_asprintf(&message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
     1715        mr_asprintf(message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
    17151716        mr_free(mds);
    17161717
     
    17261727            } else {
    17271728                log_to_screen("%s...OK", message_to_screen);
    1728                 mr_asprintf(&tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
     1729                mr_asprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
    17291730                if (!run_program_and_log_output(tmp, 1)) {
    17301731                    log_to_screen
     
    17351736            retval += res;
    17361737#ifdef DVDRWFORMAT
    1737             mr_asprintf(&tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);
     1738            mr_asprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);
    17381739            if (g_backup_media_type == dvd
    17391740                && (res || !run_program_and_log_output(tmp, 1))) {
     
    17511752                }
    17521753                pause_for_N_seconds(5, "Letting DVD drive settle");
    1753                 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
     1754                mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    17541755                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    17551756                res =
     
    18021803    } else {
    18031804        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1804         mr_asprintf(&message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
     1805        mr_asprintf(message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
    18051806        log_msg(1, message_to_screen);
    1806         mr_asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
     1807        mr_asprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
    18071808        mr_free(mds);
    18081809        if (bkpinfo->nonbootable_backup) {
     
    18741875                    "Warning - %s mounted. I'm unmounting it before I burn to it.",
    18751876                    bkpinfo->media_device);
    1876             mr_asprintf(&tmp, "umount %s", bkpinfo->media_device);
     1877            mr_asprintf(tmp, "umount %s", bkpinfo->media_device);
    18771878            run_program_and_log_output(tmp, FALSE);
    18781879            mr_free(tmp);
     
    18831884        log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);
    18841885        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1885         mr_asprintf(&message_to_screen, "Burning %s #%d", mds, g_current_media_number);
     1886        mr_asprintf(message_to_screen, "Burning %s #%d", mds, g_current_media_number);
    18861887        mr_free(mds);
    18871888        pause_and_ask_for_cdr(2, &cd_is_mountable);
     
    19031904    if (bkpinfo->call_after_iso[0] != '\0') {
    19041905        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1905         mr_asprintf(&message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
     1906        mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
    19061907        mr_free(mds);
    19071908        res =
     
    19361937    bool ret = TRUE;
    19371938
    1938     mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
     1939    mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
    19391940    log_msg(1, "command = '%s'", command);
    1940     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1941    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19411942    mr_free(command);
    19421943
     
    20112012        return (0);
    20122013    }
    2013     mr_asprintf(&tmp, "I am now backing up all large files.");
     2014    mr_asprintf(tmp, "I am now backing up all large files.");
    20142015    log_to_screen(tmp);
    20152016    noof_biggie_files = count_lines_in_file(biggielist_fname);
     
    20552056                        "Calling ntfsclone in background because %s is an NTFS partition",
    20562057                        bigfile_fname);
    2057                 mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
     2058                mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
    20582059                mkfifo(sz_devfile, 0x770);
    20592060                ntfsprog_fifo = sz_devfile;
     
    21092110                p = bigfile_fname;
    21102111            }
    2111             mr_asprintf(&tmp, "Archiving %s ... ", bigfile_fname);
     2112            mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname);
    21122113            if (res) {
    21132114                mr_strcat(tmp, "Failed!");
     
    21702171    for (; does_file_exist(curr_filelist_fname); curr_set_no++) {
    21712172        /* backup this set of files */
    2172         mr_asprintf(&curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2173        mr_asprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    21732174        if (! does_file_exist(curr_filelist_fname)) {
    21742175            mr_free(curr_filelist_fname);
     
    21762177        }
    21772178
    2178         mr_asprintf(&curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);
     2179        mr_asprintf(curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);
    21792180
    21802181        log_msg(1, "EXAT'g set %ld", curr_set_no);
    21812182        if (g_getfattr) {
    2182             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2183            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    21832184            get_fattr_list(curr_filelist_fname, curr_xattr_list_fname);
    21842185        }
    21852186        if (g_getfacl) {
    2186             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2187            mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    21872188            get_acl_list(curr_filelist_fname, curr_acl_list_fname);
    21882189        }
     
    21942195        retval += res;
    21952196        if (res) {
    2196             mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
     2197            mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    21972198            log_to_screen(tmp);
    21982199            mr_free(tmp);
     
    22462247
    22472248        if (res) {
    2248             mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
     2249            mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
    22492250            log_to_screen(tmp);
    22502251            mr_free(tmp);
     
    22562257    }
    22572258    close_progress_form();
    2258     mr_asprintf(&tmp, "Your regular files have been archived ");
     2259    mr_asprintf(tmp, "Your regular files have been archived ");
    22592260    if (retval) {
    22602261        mr_strcat(tmp, "(with errors).");
     
    23422343    mvaddstr_and_log_it(g_currentY, 0,
    23432344                        "Archiving large files to media           ");
    2344     mr_asprintf(&biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
     2345    mr_asprintf(biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
    23452346    if (g_getfattr) {
    2346         mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2347        mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    23472348    }
    23482349    if (g_getfacl) {
    2349         mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    2350     }
    2351 
    2352     mr_asprintf(&command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
     2350        mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2351    }
     2352
     2353    mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
    23532354            biggielist);
    23542355    paranoid_system(command);
    23552356    mr_free(command);
    23562357
    2357     mr_asprintf(&blah, "biggielist = %s", biggielist);
     2358    mr_asprintf(blah, "biggielist = %s", biggielist);
    23582359    log_msg(2, blah);
    23592360    mr_free(blah);
     
    23652366    if (g_getfattr) {
    23662367        get_fattr_list(biggielist, xattr_fname);
    2367         mr_asprintf(&command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir);
     2368        mr_asprintf(command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir);
    23682369        paranoid_system(command);
    23692370        mr_free(command);
     
    23712372    if (g_getfacl) {
    23722373        get_acl_list(biggielist, acl_fname);
    2373         mr_asprintf(&command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);
     2374        mr_asprintf(command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);
    23742375        paranoid_system(command);
    23752376        mr_free(command);
     
    23782379    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    23792380        res += write_EXAT_files_to_tape(xattr_fname, acl_fname);
    2380         mr_asprintf(&blah, "%ld", count_lines_in_file(biggielist));
     2381        mr_asprintf(blah, "%ld", count_lines_in_file(biggielist));
    23812382        write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES);
    23822383        mr_free(blah);
     
    24542455            continue;
    24552456        }
    2456         mr_asprintf(&curr_file, "%s", cf);
     2457        mr_asprintf(curr_file, "%s", cf);
    24572458        if (!does_file_exist(curr_file)) {
    24582459            log_msg(1,
     
    24832484            continue;
    24842485        }
    2485         mr_asprintf(&curr_file, "%s", cf);
    2486 
    2487         mr_asprintf(&tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
     2486        mr_asprintf(curr_file, "%s", cf);
     2487
     2488        mr_asprintf(tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
    24882489        mr_free(curr_file);
    24892490        res = run_program_and_log_output(tmp, 5);
     
    25582559            continue;
    25592560        }
    2560         mr_asprintf(&curr_file, "%s", cf);
     2561        mr_asprintf(curr_file, "%s", cf);
    25612562        if (!does_file_exist(curr_file)) {
    25622563            log_msg(1,
     
    26162617    char *cdrecord = NULL;
    26172618
    2618     mr_asprintf(&bkp, "%s", cdrw_dev);
     2619    mr_asprintf(bkp, "%s", cdrw_dev);
    26192620    if (find_cdrw_device(cdrw_dev)) {
    26202621        strcpy(cdrw_dev, bkp);
    26212622    } else {
    26222623        if (!system("which cdrecord > /dev/null 2> /dev/null")) {
    2623             mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2624            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
    26242625        } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) {
    2625             mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2626            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
    26262627        } else {
    26272628            log_msg(2, "Oh well. I guess I'll just pray then.");
     
    26812682
    26822683    mds = media_descriptor_string(g_backup_media_type);
    2683     mr_asprintf(&tmp, "I am about to burn %s #%d", mds, g_current_media_number);
     2684    mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number);
    26842685    mr_free(mds);
    26852686    log_to_screen(tmp);
     
    26992700      retract_CD_tray_and_defeat_autorun();
    27002701*/
    2701         mr_asprintf(&tmp, "umount %s", cdrom_dev);
     2702        mr_asprintf(tmp, "umount %s", cdrom_dev);
    27022703        run_program_and_log_output(tmp, 1);
    27032704        sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
     
    27052706        sprintf(szunmount, "umount %s", mtpt);
    27062707        cd_number = -1;
    2707         mr_asprintf(&tmp, "mount %s %s", cdrom_dev, mtpt);
    2708         mr_asprintf(&our_serial_str, "%s", "");
     2708        mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt);
     2709        mr_asprintf(our_serial_str, "%s", "");
    27092710        attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1);
    27102711        mr_free(tmp);
     
    27352736
    27362737            cd_number = atoi(last_line_of_file(szcdno));
    2737             mr_asprintf(&tmp, "cat %s 2> /dev/null", szserfname);
     2738            mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname);
    27382739            mr_free(our_serial_str);
    2739             mr_asprintf(&our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));
     2740            mr_asprintf(our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));
    27402741            mr_free(tmp);
    27412742            // FIXME - should be able to use last_line_of_file(), surely?
     
    27732774        eject_device(cdrom_dev);
    27742775        mds = media_descriptor_string(g_backup_media_type);
    2775         mr_asprintf(&tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", mds, g_current_media_number, mds);
     2776        mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", mds, g_current_media_number, mds);
    27762777        mr_free(mds);
    27772778
     
    29182919    if (is_this_file_compressed(biggie_filename)
    29192920        || bkpinfo->compression_level == 0) {
    2920         mr_asprintf(&suffix, "%s", "");
     2921        mr_asprintf(suffix, "%s", "");
    29212922        //      log_it("%s is indeed compressed :-)", filename);
    29222923        should_I_compress_slices = FALSE;
    29232924    } else {
    2924         mr_asprintf(&suffix, "%s", bkpinfo->zip_suffix);
     2925        mr_asprintf(suffix, "%s", bkpinfo->zip_suffix);
    29252926        should_I_compress_slices = TRUE;
    29262927    }
     
    29382939            fatal_error("ntfsresize not found");
    29392940        }
    2940         mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
     2941        mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
    29412942        log_it("command = %s", command);
    2942         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2943        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    29432944        mr_free(command);
    29442945        log_it("res of it = %s", tmp);
     
    29482949        file_to_openin = biggie_filename;
    29492950        if (strchr(biggie_filename,'\'') != NULL) {
    2950             mr_asprintf(&command, "md5sum \"%s\"", biggie_filename);
     2951            mr_asprintf(command, "md5sum \"%s\"", biggie_filename);
    29512952        } else {
    2952             mr_asprintf(&command, "md5sum '%s'", biggie_filename);
     2953            mr_asprintf(command, "md5sum '%s'", biggie_filename);
    29532954        }
    29542955        if (!(fin = popen(command, "r"))) {
     
    29732974    strcpy(biggiestruct.checksum, checksum_line);
    29742975
    2975     mr_asprintf(&tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
     2976    mr_asprintf(tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
    29762977    fout = fopen(tmp, "w");
    29772978    if (fout == NULL) {
     
    29922993    if (!(fin = fopen(file_to_openin, "r"))) {
    29932994        log_OS_error("Unable to openin biggie_filename");
    2994         mr_asprintf(&tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
     2995        mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
    29952996        log_to_screen(tmp);
    29962997        paranoid_free(tmp);
     
    30143015    }
    30153016    for (slice_num = 1; !finished; slice_num++) {
    3016         mr_asprintf(&curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
    3017         mr_asprintf(&curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
     3017        mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
     3018        mr_asprintf(curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
    30183019
    30193020       
     
    30503051            }
    30513052            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
    3052                 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
     3053                mr_asprintf(command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
    30533054                log_msg(2, command);
    30543055                if ((res = system(command))) {
     
    30573058                //          did_I_compress_slice = TRUE;
    30583059            } else {
    3059                 mr_asprintf(&command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
     3060                mr_asprintf(command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
    30603061                res = 0;        // don't do it :)
    30613062                //          did_I_compress_slice = FALSE;
     
    30733074            }
    30743075            if (res) {
    3075                 mr_asprintf(&tmp, "Problem with slice # %ld", slice_num);
     3076                mr_asprintf(tmp, "Problem with slice # %ld", slice_num);
    30763077            } else {
    3077                 mr_asprintf(&tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1, slice_num);
     3078                mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1, slice_num);
    30783079            }
    30793080#ifndef _XWIN
     
    30893090            paranoid_free(tmp);
    30903091
    3091             mr_asprintf(&file_to_archive, "%s", curr_slice_fname_compressed);
     3092            mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed);
    30923093            g_current_progress++;
    30933094        } else {                /* if i==0 then ... */
    30943095
    30953096            finished = TRUE;
    3096             mr_asprintf(&file_to_archive, "%s", curr_slice_fname_uncompressed);
     3097            mr_asprintf(file_to_archive, "%s", curr_slice_fname_uncompressed);
    30973098            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    30983099                break;
     
    31143115        retval += res;
    31153116        if (res) {
    3116             mr_asprintf(&tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
     3117            mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    31173118            log_to_screen(tmp);
    31183119            paranoid_free(tmp);
     
    31243125    mr_free(suffix);
    31253126    paranoid_fclose(fin);
    3126     mr_asprintf(&tmp, "Sliced bigfile #%ld", biggie_file_number + 1);
     3127    mr_asprintf(tmp, "Sliced bigfile #%ld", biggie_file_number + 1);
    31273128    if (retval) {
    31283129        mr_strcat(tmp, "...FAILED");
     
    31583159    assert_string_is_neither_NULL_nor_zerolength(d);
    31593160
    3160     mr_asprintf(&dir, "%s/archives", d);
    3161     mr_asprintf(&tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);
     3161    mr_asprintf(dir, "%s/archives", d);
     3162    mr_asprintf(tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);
    31623163    run_program_and_log_output(tmp, FALSE);
    31633164    mr_free(tmp);
    3164     mr_asprintf(&tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);
     3165    mr_asprintf(tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);
    31653166    run_program_and_log_output(tmp, FALSE);
    31663167    mr_free(tmp);
    3167     mr_asprintf(&tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);
     3168    mr_asprintf(tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);
    31683169    run_program_and_log_output(tmp, FALSE);
    31693170    mr_free(tmp);
    3170     mr_asprintf(&tmp, "rm -f %s/cklist*", dir);
     3171    mr_asprintf(tmp, "rm -f %s/cklist*", dir);
    31713172    run_program_and_log_output(tmp, FALSE);
    31723173    mr_free(tmp);
    3173     mr_asprintf(&tmp, "rm -f %s/zero", dir);
     3174    mr_asprintf(tmp, "rm -f %s/zero", dir);
    31743175    run_program_and_log_output(tmp, FALSE);
    31753176    mr_free(tmp);
    31763177    log_msg(1, "Wiped %s's archives", dir);
    3177     mr_asprintf(&tmp, "ls -l %s", dir);
     3178    mr_asprintf(tmp, "ls -l %s", dir);
    31783179    mr_free(dir);
    31793180    run_program_and_log_output(tmp, FALSE);
     
    32803281    /* label the ISO with its number */
    32813282
    3282     mr_asprintf(&cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);
     3283    mr_asprintf(cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);
    32833284    fout = fopen(cdno_fname, "w");
    32843285    mr_free(cdno_fname);
     
    32873288    paranoid_fclose(fout);
    32883289
    3289     mr_asprintf(&tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir);
     3290    mr_asprintf(tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir);
    32903291    if (run_program_and_log_output(tmp1, FALSE)) {
    32913292        log_msg(2, "Warning - unable to copy autorun to scratchdir");
     
    32943295
    32953296    /* last CD or not? Label accordingly */
    3296     mr_asprintf(&lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
     3297    mr_asprintf(lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    32973298    if (last_cd) {
    32983299        unlink(lastcd_fname);
     
    33093310    if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 >
    33103311        bkpinfo->media_size[g_current_media_number]) {
    3311         mr_asprintf(&tmp1, "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir),
    3312                 (long) bkpinfo->media_size[g_current_media_number]);
     3312        mr_asprintf(tmp1, "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]);
    33133313        log_to_screen(tmp1);
    33143314        mr_free(tmp1);
    33153315    }
    3316     mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     3316    mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    33173317    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    33183318        if (bkpinfo->backup_media_type != usb) {
     
    33513351        } else {
    33523352            mds = media_descriptor_string(bkpinfo->backup_media_type);
    3353             mr_asprintf(&tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
     3353            mr_asprintf(tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
    33543354            mr_free(mds);
    33553355            res = ask_me_yes_or_no(tmp1);
     
    33753375    }
    33763376    wipe_archives(bkpinfo->scratchdir);
    3377     mr_asprintf(&tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);
     3377    mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);
    33783378    if (system(tmp1)) {
    33793379        log_msg
     
    34323432        log_msg(2,
    34333433                "Not verifying again. Per-CD/ISO verification already carried out.");
    3434         mr_asprintf(&tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);
     3434        mr_asprintf(tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);
    34353435        paranoid_system(tmp);
    34363436        mr_free(tmp);
     
    34553455            if (res) {
    34563456                mds = media_descriptor_string(bkpinfo->backup_media_type);
    3457                 mr_asprintf(&tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3457                mr_asprintf(tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    34583458                mr_free(mds);
    34593459                log_to_screen(tmp);
     
    34623462            }
    34633463        }
    3464         mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
     3464        mr_asprintf(tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    34653465        (void)system(tmp);
    34663466        mr_free(tmp);
    34673467
    3468         mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
     3468        mr_asprintf(tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    34693469        (void)system(tmp);
    34703470        mr_free(tmp);
     
    34753475//}
    34763476    }
    3477     mr_asprintf(&tmp, "%s/changed.files", MONDO_CACHE);
     3477    mr_asprintf(tmp, "%s/changed.files", MONDO_CACHE);
    34783478    diffs = count_lines_in_file(tmp);
    34793479    mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2322 r2323  
    111111    for (i = 0; i < 128; i++) {
    112112        if (flag_set[i]) {
    113             mr_asprintf(&tmp, "-%c %s", i, flag_val[i]);
     113            mr_asprintf(tmp, "-%c %s", i, flag_val[i]);
    114114            log_msg(3, tmp);
    115115            mr_free(tmp);
    116116        }
    117117    }
    118     mr_asprintf(&tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);
     118    mr_asprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);
    119119    paranoid_system(tmp);
    120120    mr_free(tmp);
    121121
    122     mr_asprintf(&tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);
     122    mr_asprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);
    123123    paranoid_system(tmp);
    124124    mr_free(tmp);
     
    126126    mr_strcat(bkpinfo->scratchdir, "/mondo.scratch.%ld", random() % 32767);
    127127
    128     mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
     128    mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
    129129    paranoid_system(tmp);
    130130    mr_free(tmp);
    131131
    132     mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->scratchdir);
     132    mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir);
    133133    paranoid_system(tmp);
    134134    mr_free(tmp);
     
    161161        *(strchr(tmp, ',')) = '\0';
    162162        bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(tmp);
    163         mr_asprintf(&comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);
     163        mr_asprintf(comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);
    164164        log_msg(3, comment);
    165165        mr_free(comment);
     
    279279    ********/
    280280    /* Get the number of mounted file systems ((those that start with "/dev/" */
    281     mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
     281    mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
    282282    log_msg(5, "Running: %s", command);
    283     mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     283    mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    284284    mr_free(command);
    285285
     
    289289
    290290    for (i=mount_cnt; i > 0; i--) {
    291         mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
     291        mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
    292292        log_msg(5, "Running: %s", command);
    293         mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     293        mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    294294        mr_free(command);
    295295
     
    373373    log_msg(5, "  %s looks like a device special file", dsf);
    374374    /* Verify that the dsf exists */
    375     mr_asprintf(&command, "ls -al %s 2>/dev/null | wc -l", dsf);
     375    mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf);
    376376    log_msg(5, "  Executing: %s", command);
    377     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     377    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    378378    mr_free(command);
    379379
     
    399399    * Either way, it's an error.
    400400    ********/
    401     mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     401    mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    402402    log_msg(4, "Executing: %s", command);
    403     mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command));
     403    mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));
    404404    mr_free(command);
    405405    log_msg(4, "Partition list for %s: %s", dsf, partition_list);
     
    452452        log_msg(4, "Processing partition: %s", partitions[i]);
    453453        /* See if it's swap. If it is, ignore it. */
    454         mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
     454        mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    455455          dsf, partitions[i]);
    456456        log_msg(4, "  Running: %s", command);
    457         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     457        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    458458        mr_free(command);
    459459
     
    467467        }
    468468        /* It's not swap. See if we can find the mount point from the mount command. */
    469         mr_asprintf(&command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
    470         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     469        mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
     470        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    471471        mr_free(command);
    472472
     
    486486        log_msg(4, "  It's not mounted. Checking to see if it's LVM...");
    487487        /* Get the partition ID; 8e for LVM */
    488         mr_asprintf(&command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);
     488        mr_asprintf(command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);
    489489        log_msg(4, "  Running: %s", command);
    490         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     490        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    491491        mr_free(command);
    492492        if (strlen(tmp)) {
     
    495495                /* It's LVM: Find the VG it's in */
    496496                log_msg(4, "  It's LVM: Find the VG it's in...");
    497                 mr_asprintf(&command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
     497                mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
    498498                log_msg(4, "  Running: %s", command);
    499499                strcpy(VG, call_program_and_get_last_line_of_output(command));
     
    503503                    /* Found the Volume Group. Now find all of the VG's mount points */
    504504                    log_msg(4, "  Found the Volume Group. Now find all of the VG's mount points");
    505                     mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
     505                    mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    506506                    log_msg(4, "  Running: %s", command);
    507                     mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     507                    mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    508508                    mr_free(command);
    509509                    log_msg(4, "  VG %s mount_list: %s", VG, mount_list);
     
    525525                     *******/
    526526                    mr_free(mount_list);
    527                     mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     527                    mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    528528                    log_msg (5, "Running: %s", command);
    529                     mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     529                    mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    530530                    mr_free(command);
    531531                    log_msg(4, "  Software raid device list: %s", mount_list);
    532532                    lastpos = 0;
    533533                    while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    534                         mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
     534                        mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
    535535                        log_msg (5, "Running: %s", command);
    536536                        mr_free(tmp);
    537                         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     537                        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    538538                        mr_free(command);
    539539                        log_msg(4, "Number of Software raid device: %s", tmp);
     
    567567         ********/
    568568        log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device.");
    569         mr_asprintf(&command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
     569        mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
    570570        log_msg(4, "  Running: %s", command);
    571         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     571        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    572572        mr_free(command);
    573573        if (!strlen(tmp)) {
     
    578578        log_msg (5, "  UUID: %s", tmp);
    579579        /* Get the Software raid device list */
    580         mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     580        mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    581581        log_msg (5, "  Running: %s", command);
    582         mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     582        mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    583583        mr_free(command);
    584584        log_msg(4, "  Software raid device list: %s", mount_list);
     
    586586        lastpos = 0;
    587587        while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    588             mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
     588            mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
    589589            log_msg(4, "  Running: %s", command);
    590590            mr_free(tmp);
    591             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     591            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    592592            mr_free(command);
    593593            if (!atoi(tmp)) {
     
    760760        }
    761761
    762         mr_asprintf(&tmp1, "%s", flag_val['I']);
     762        mr_asprintf(tmp1, "%s", flag_val['I']);
    763763        p = tmp1;
    764764        q = tmp1;
     
    797797                log_to_screen("Archiving only the following file systems on %s:\n", token);
    798798                log_to_screen("  %s\n", mounted_on_dsf);
    799                 mr_asprintf(&p, "/");
     799                mr_asprintf(p, "/");
    800800                mr_free(bkpinfo->include_paths);
    801801                bkpinfo->include_paths = p;
     
    837837        }
    838838        bkpinfo->make_filelist = FALSE;
    839         mr_asprintf(&p, "%s", flag_val['J']);
     839        mr_asprintf(p, "%s", flag_val['J']);
    840840        mr_free(bkpinfo->include_paths);
    841841        bkpinfo->include_paths = p;
     
    903903        strcpy(flag_val['d'], p);
    904904        mr_free(p);
    905         mr_asprintf(&tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
     905        mr_asprintf(tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
    906906        log_to_screen(tmp1);
    907907        mr_free(tmp1);
     
    954954            }
    955955        }
    956 /*
    957       if (flag_set['Z']) {
    958       bkpinfo->blank_dvd_first = TRUE;
    959       }
    960 */
    961956    }
    962957
     
    10091004            p--;
    10101005            *p = '\0';
    1011             mr_asprintf(&q,"%s",bkpinfo->nfs_mount);
     1006            mr_asprintf(q,"%s",bkpinfo->nfs_mount);
    10121007            bkpinfo->nfs_user = q;
    10131008            strcpy(bkpinfo->nfs_mount,tmp);
    10141009        }
    1015         mr_asprintf(&tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3",
    1016                 bkpinfo->nfs_mount);
    1017         strncpy(bkpinfo->isodir,
    1018                 call_program_and_get_last_line_of_output(tmp1),
    1019                 MAX_STR_LEN / 4);
     1010        mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1011        mr_free(bkpinfo->isodir);
     1012        mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1013        bkpinfo->isodir = tmp2;
    10201014        mr_free(tmp1);
    10211015
    10221016        if (strlen(bkpinfo->isodir) < 3) {
    10231017            log_to_screen("NFS share is not mounted. Trying to mount it for you.\n");
    1024             mr_asprintf(&tmp1, "mount %s", bkpinfo->nfs_mount);
     1018            mr_asprintf(tmp1, "mount %s", bkpinfo->nfs_mount);
    10251019            i = system(tmp1);
    10261020            mr_free(tmp1);
     
    10291023                retval++;
    10301024            } else {
    1031                 mr_asprintf(&tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
    1032                 strncpy(bkpinfo->isodir,
    1033                         call_program_and_get_last_line_of_output(tmp1),
    1034                         MAX_STR_LEN / 4);
     1025                mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1026                mr_free(bkpinfo->isodir);
     1027                mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1028                bkpinfo->isodir = tmp2;
    10351029                mr_free(tmp1);
    10361030
     
    10781072    if (flag_set['z']) {
    10791073        if (find_home_of_exe("getfattr")) {
    1080             mr_asprintf(&g_getfattr,"getfattr");
     1074            mr_asprintf(g_getfattr,"getfattr");
    10811075        }
    10821076        if (find_home_of_exe("getfacl")) {
    1083             mr_asprintf(&g_getfacl,"getfacl");
     1077            mr_asprintf(g_getfacl,"getfacl");
    10841078        }
    10851079    }
     
    10951089            log_to_screen("Please supply a sensible value with '-E'\n");
    10961090        }
    1097         mr_asprintf(&tmp1, "%s", flag_val['E']);
     1091        mr_asprintf(tmp1, "%s", flag_val['E']);
    10981092
    10991093        p = tmp1;
     
    11631157    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude NFS mounts & devices
    11641158    {
    1165         mr_asprintf(&psz, "%s", list_of_NFS_mounts_only());
     1159        mr_asprintf(psz, "%s", list_of_NFS_mounts_only());
    11661160        mr_strcat(bkpinfo->exclude_paths, " %s ", psz);
    11671161        mr_free(psz);
     
    11731167
    11741168    if (flag_set['b']) {
    1175         mr_asprintf(&psz, "%s", flag_val['b']);
     1169        mr_asprintf(psz, "%s", flag_val['b']);
    11761170        log_msg(1, "psz = '%s'", psz);
    11771171        if (psz[strlen(psz) - 1] == 'k') {
     
    12191213            && !does_file_exist(bkpinfo->kernel_path)) {
    12201214            retval++;
    1221             mr_asprintf(&tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
     1215            mr_asprintf(tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
    12221216            log_to_screen(tmp1);
    12231217            mr_free(tmp1);
     
    12271221    if (flag_set['p']) {
    12281222        mr_free(bkpinfo->prefix);
    1229         mr_asprintf(&tmp1, "%s", flag_val['p']);
     1223        mr_asprintf(tmp1, "%s", flag_val['p']);
    12301224        bkpinfo->prefix = tmp1;
    12311225        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
     
    12341228    if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
    12351229        if (flag_set['i']) {
    1236             strncpy(bkpinfo->isodir, flag_val['d'], MAX_STR_LEN / 4);
    1237             mr_asprintf(&tmp1, "ls -l %s", bkpinfo->isodir);
     1230            mr_free(bkpinfo->isodir);
     1231            mr_asprintf(tmp2, "%s", flag_val['d']);
     1232            bkpinfo->isodir = tmp2;
     1233            mr_asprintf(tmp1, "ls -l %s", bkpinfo->isodir);
    12381234            if (run_program_and_log_output(tmp1, 2)) {
    12391235                mr_free(tmp1);
    1240                 fatal_error
    1241                     ("output folder does not exist - please create it");
     1236                fatal_error("output folder does not exist - please create it");
    12421237            }
    12431238            mr_free(tmp1);
     
    12501245
    12511246    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    1252         mr_asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
     1247        mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    12531248        if (bkpinfo->nfs_user) {
    1254             mr_asprintf(&tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1);
     1249            mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1);
    12551250        } else {
    1256             mr_asprintf(&tmp2, "echo hi > %s", tmp1);
     1251            mr_asprintf(tmp2, "echo hi > %s", tmp1);
    12571252        }
    12581253        i = run_program_and_log_output(tmp2, 2);
     
    12611256        if (i) {
    12621257            retval++;
    1263             mr_asprintf(&tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount);
     1258            mr_asprintf(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount);
    12641259            log_to_screen(tmp2);
    12651260            mr_free(tmp2);
     
    13021297
    13031298    if (flag_set['S']) {
    1304         mr_asprintf(&tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);
     1299        mr_asprintf(tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);
    13051300        mr_free(bkpinfo->scratchdir);
    13061301        bkpinfo->scratchdir = tmp1;
     
    13091304    if (flag_set['T']) {
    13101305        setup_tmpdir(flag_val['T']);
    1311         mr_asprintf(&tmp1, "touch %s/.foo.dat", bkpinfo->tmpdir);
     1306        mr_asprintf(tmp1, "touch %s/.foo.dat", bkpinfo->tmpdir);
    13121307        i = run_program_and_log_output(tmp1, 1);
    13131308        mr_free(tmp1);
     
    13181313            fatal_error("I cannot write to the tempdir you specified.");
    13191314        }
    1320         mr_asprintf(&tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir);
     1315        mr_asprintf(tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir);
    13211316        i = run_program_and_log_output(tmp1, 1);
    13221317        mr_free(tmp1);
     
    15151510            if (flag_set[opt]) {
    15161511                bad_switches = TRUE;
    1517                 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
     1512                mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    15181513                log_to_screen(tmp);
    15191514                mr_free(tmp);
     
    15311526                        if (strchr(flag_val[opt], '/')
    15321527                            && flag_val[opt][0] != '/') {
    1533                             mr_asprintf(&tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
     1528                            mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    15341529                            log_to_screen(tmp);
    15351530                            mr_free(tmp);
     
    15441539    for (i = optind; i < argc; i++) {
    15451540        bad_switches = TRUE;
    1546         mr_asprintf(&tmp, "Invalid arg -- %s\n", argv[i]);
     1541        mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]);
    15471542        log_to_screen(tmp);
    15481543        mr_free(tmp);
     
    15751570    switch (sig) {
    15761571    case SIGINT:
    1577         mr_asprintf(&tmp, "SIGINT");
    1578         mr_asprintf(&tmp2, "You interrupted me :-)");
     1572        mr_asprintf(tmp, "SIGINT");
     1573        mr_asprintf(tmp2, "You interrupted me :-)");
    15791574        break;
    15801575    case SIGKILL:
    1581         mr_asprintf(&tmp, "SIGKILL");
    1582         mr_asprintf(&tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
     1576        mr_asprintf(tmp, "SIGKILL");
     1577        mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
    15831578        break;
    15841579    case SIGTERM:
    1585         mr_asprintf(&tmp, "SIGTERM");
    1586         mr_asprintf(&tmp2, "Got terminate signal");
     1580        mr_asprintf(tmp, "SIGTERM");
     1581        mr_asprintf(tmp2, "Got terminate signal");
    15871582        break;
    15881583    case SIGHUP:
    1589         mr_asprintf(&tmp, "SIGHUP");
    1590         mr_asprintf(&tmp2, "Hangup on line");
     1584        mr_asprintf(tmp, "SIGHUP");
     1585        mr_asprintf(tmp2, "Hangup on line");
    15911586        break;
    15921587    case SIGSEGV:
    1593         mr_asprintf(&tmp, "SIGSEGV");
    1594         mr_asprintf(&tmp2, "Internal programming error. Please send a backtrace as well as your log.");
     1588        mr_asprintf(tmp, "SIGSEGV");
     1589        mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log.");
    15951590        break;
    15961591    case SIGPIPE:
    1597         mr_asprintf(&tmp, "SIGPIPE");
    1598         mr_asprintf(&tmp2, "Pipe was broken");
     1592        mr_asprintf(tmp, "SIGPIPE");
     1593        mr_asprintf(tmp2, "Pipe was broken");
    15991594        break;
    16001595    case SIGABRT:
    1601         mr_asprintf(&tmp, "SIGABRT");
    1602         mr_asprintf(&tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
     1596        mr_asprintf(tmp, "SIGABRT");
     1597        mr_asprintf(tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
    16031598        break;
    16041599    default:
    1605         mr_asprintf(&tmp, "(Unknown)");
    1606         mr_asprintf(&tmp2, "(Unknown)");
     1600        mr_asprintf(tmp, "(Unknown)");
     1601        mr_asprintf(tmp2, "(Unknown)");
    16071602    }
    16081603
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2322 r2323  
    111111    bool is_this_a_ramdisk = FALSE;
    112112
    113     mr_asprintf(&tmp, "%s", where_is_root_mounted());
    114     mr_asprintf(&comment, "root is currently mounted at %s\n", tmp);
     113    mr_asprintf(tmp, "%s", where_is_root_mounted());
     114    mr_asprintf(comment, "root is currently mounted at %s\n", tmp);
    115115    log_msg(0, comment);
    116116    mr_free(comment);
     
    210210    if (IS_THIS_A_STREAMING_BACKUP(g_backup_media_type)
    211211        && g_backup_media_type != udev) {
    212         mr_asprintf(&command, "mt -f %s offline", dev);
     212        mr_asprintf(command, "mt -f %s offline", dev);
    213213        res1 = run_program_and_log_output(command, 1);
    214214        mr_free(command);
     
    219219#ifdef __FreeBSD__
    220220    if (strstr(dev, "acd")) {
    221         mr_asprintf(&command, "cdcontrol -f %s eject", dev);
     221        mr_asprintf(command, "cdcontrol -f %s eject", dev);
    222222    } else {
    223         mr_asprintf(&command, "camcontrol eject `echo %s | sed 's|/dev/||'`",
     223        mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`",
    224224                dev);
    225225    }
    226226#else
    227     mr_asprintf(&command, "eject %s", dev);
     227    mr_asprintf(command, "eject %s", dev);
    228228#endif
    229229
     
    250250#ifdef __FreeBSD__
    251251    if (strstr(dev, "acd")) {
    252         mr_asprintf(&command, "cdcontrol -f %s close", dev);
     252        mr_asprintf(command, "cdcontrol -f %s close", dev);
    253253    } else {
    254         mr_asprintf(&command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev);
     254        mr_asprintf(command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev);
    255255    }
    256256#else
    257     mr_asprintf(&command, "eject -t %s", dev);
     257    mr_asprintf(command, "eject -t %s", dev);
    258258#endif
    259259    i = run_program_and_log_output(command, FALSE);
     
    277277    assert_string_is_neither_NULL_nor_zerolength(device);
    278278
    279     mr_asprintf(&tmp, "ls %s > /dev/null 2> /dev/null", device);
     279    mr_asprintf(tmp, "ls %s > /dev/null 2> /dev/null", device);
    280280
    281281    if (system(tmp)) {
     
    336336    // We assume here that this is running from mondorestore. (It is.)
    337337    tmp = build_partition_name(drive, partno);
    338     mr_asprintf(&program, "ls %s %s >/dev/null 2>&1", drive, tmp);
     338    mr_asprintf(program, "ls %s %s >/dev/null 2>&1", drive, tmp);
    339339    mr_free(tmp);
    340340
     
    347347#endif
    348348
    349     mr_asprintf(&program, "parted2fdisk -l %s 2> /dev/null", drive);
     349    mr_asprintf(program, "parted2fdisk -l %s 2> /dev/null", drive);
    350350    fin = popen(program, "r");
    351351    if (!fin) {
     
    394394    assert_string_is_neither_NULL_nor_zerolength(str);
    395395
    396     mr_asprintf(&command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str);
     396    mr_asprintf(command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str);
    397397    i = system(command);
    398398    mr_free(command);
     
    418418    int i;
    419419
    420     mr_asprintf(&command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str);
     420    mr_asprintf(command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str);
    421421    i = system(command);
    422422    mr_free(command);
     
    517517    run_program_and_log_output("insmod ide-scsi", -1);
    518518    if (find_home_of_exe("cdrecord")) {
    519         mr_asprintf(&cdr_exe, "cdrecord");
     519        mr_asprintf(cdr_exe, "cdrecord");
    520520    } else {
    521         mr_asprintf(&cdr_exe, "dvdrecord");
     521        mr_asprintf(cdr_exe, "dvdrecord");
    522522    }
    523523    if (find_home_of_exe(cdr_exe)) {
    524         mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
    525         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     524        mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
     525        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    526526        mr_free(command);
    527527    }
     
    532532    } else {
    533533        strcpy(cdrw_device, tmp);
    534         mr_asprintf(&comment, "Found CDRW device - %s", cdrw_device);
     534        mr_asprintf(comment, "Found CDRW device - %s", cdrw_device);
    535535        log_it(comment);
    536536        strcpy(g_cdrw_drive_is_here, cdrw_device);
     
    586586    phrase_two[0] = '\0';
    587587#ifndef __FreeBSD__
    588     mr_asprintf(&dvd_last_resort, "%s", "");;
     588    mr_asprintf(dvd_last_resort, "%s", "");;
    589589#endif
    590590
     
    606606    }
    607607
    608     mr_asprintf(&mountpoint, "%s/cd.mnt", bkpinfo->tmpdir);
     608    mr_asprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir);
    609609    make_hole_for_dir(mountpoint);
    610610
    611611    if (find_home_of_exe("cdrecord")) {
    612         mr_asprintf(&cdr_exe, "cdrecord");
     612        mr_asprintf(cdr_exe, "cdrecord");
    613613    } else {
    614         mr_asprintf(&cdr_exe, "dvdrecord");
     614        mr_asprintf(cdr_exe, "dvdrecord");
    615615    }
    616616    tmp[0] = '\0';
     
    628628    }
    629629
    630     mr_asprintf(&command, "%s -scanbus 2> /dev/null", cdr_exe);
     630    mr_asprintf(command, "%s -scanbus 2> /dev/null", cdr_exe);
    631631    fin = popen(command, "r");
    632632    log_msg(4, "command=%s", command);
     
    668668        log_msg(4, "Not running phase two. String is empty.");
    669669    } else {
    670         mr_asprintf(&command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two);
     670        mr_asprintf(command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two);
    671671        fin = popen(command, "r");
    672672        mr_free(command);
     
    684684                        if (strstr(tmp, "DVD")) {
    685685                            mr_free(dvd_last_resort);
    686                             mr_asprintf(&dvd_last_resort, "/dev/%s", tmp);
     686                            mr_asprintf(dvd_last_resort, "/dev/%s", tmp);
    687687                            log_msg(4,
    688688                                    "Ignoring '%s' because it's a DVD drive",
     
    815815                found_it = FALSE;
    816816            } else {
    817                 mr_asprintf(&command, "umount %s", output);
     817                mr_asprintf(command, "umount %s", output);
    818818                paranoid_system(command);
    819819                mr_free(command);
     
    838838    }
    839839
    840     mr_asprintf(&command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
     840    mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
    841841    log_msg(1, "command=%s", command);
    842     mr_asprintf(&tmp1, "%s", call_program_and_get_last_line_of_output(command));
     842    mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command));
    843843    mr_free(command);
    844844
     
    876876    }
    877877
    878     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output
     878    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output
    879879            ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    880880        );
     
    882882    if (!tmp[0])
    883883        mr_free(tmp);
    884         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output
     884        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output
    885885                ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    886886            );
     
    10261026    assert_string_is_neither_NULL_nor_zerolength(format);
    10271027
    1028     mr_asprintf(&format_sz, "%s ", format);
     1028    mr_asprintf(format_sz, "%s ", format);
    10291029
    10301030#ifdef __FreeBSD__
    1031     mr_asprintf(&command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");
     1031    mr_asprintf(command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");
    10321032#else
    1033     mr_asprintf(&command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
     1033    mr_asprintf(command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
    10341034#endif
    10351035
     
    10941094        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
    10951095                device_raw);
    1096         mr_asprintf(&tmp, "/%s", device_raw);
     1096        mr_asprintf(tmp, "/%s", device_raw);
    10971097    } else {
    1098         mr_asprintf(&tmp, "%s", device_raw);
     1098        mr_asprintf(tmp, "%s", device_raw);
    10991099    }
    11001100    log_msg(1, "Is %s mounted?", tmp);
     
    11051105        return(FALSE);
    11061106    }
    1107     mr_asprintf(&device_with_tab, "%s\t", tmp);
    1108     mr_asprintf(&device_with_space, "%s ", tmp);
     1107    mr_asprintf(device_with_tab, "%s\t", tmp);
     1108    mr_asprintf(device_with_space, "%s ", tmp);
    11091109    mr_free(tmp);
    11101110
     
    11261126    mr_free(device_with_space);
    11271127    paranoid_pclose(fin);
    1128     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
     1128    mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11291129    log_msg(4, "tmp (command) = '%s'", tmp);
    11301130    if (!system(tmp)) {
     
    11931193        (call_program_and_get_last_line_of_output
    11941194         ("/sbin/sysctl -n kern.osreldate")) < 500000) {
    1195         mr_asprintf(&command, "vnconfig -d %s", dname);
     1195        mr_asprintf(command, "vnconfig -d %s", dname);
    11961196    } else {
    1197         mr_asprintf(&command, "mdconfig -d -u %s", dname);
     1197        mr_asprintf(command, "mdconfig -d -u %s", dname);
    11981198    }
    11991199    res = system(command);
     
    12271227
    12281228#ifdef __FreeBSD__
    1229     mr_asprintf(&command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1229    mr_asprintf(command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12301230
    12311231#else
    1232     mr_asprintf(&command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1232    mr_asprintf(command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12331233#endif
    12341234
     
    12671267    }
    12681268#ifndef __FreeBSD__
    1269     mr_asprintf(&options, "ro");
     1269    mr_asprintf(options, "ro");
    12701270#endif
    12711271
     
    12731273
    12741274#ifdef __FreeBSD__
    1275         mr_asprintf(&dev, "%s", make_vn(device));
     1275        mr_asprintf(dev, "%s", make_vn(device));
    12761276        if (!dev) {
    1277             mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     1277            mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device);
    12781278            fatal_error(command);
    12791279        }
     
    12901290
    12911291#ifdef __FreeBSD__
    1292     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1292    mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12931293
    12941294#else
    1295     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
     1295    mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    12961296    paranoid_free(options);
    12971297#endif
     
    13341334    /*@ buffers ********************************************************* */
    13351335    char *tmp = NULL;
     1336    char *p = NULL;
    13361337    char *mds = NULL;
    13371338    char *request = NULL;
     
    13471348        return;
    13481349    }
    1349     mr_asprintf(&tmp, "mkdir -p " MNT_CDROM);
     1350    mr_asprintf(tmp, "mkdir -p " MNT_CDROM);
    13501351    run_program_and_log_output(tmp, 5);
    13511352    mr_free(tmp);
     
    13601361            run_program_and_log_output("umount " MNT_CDROM, 5);
    13611362        }
    1362         mr_asprintf(&tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
     1363        mr_asprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
    13631364        (void)system(tmp);
    13641365        mr_free(tmp);
    13651366
    1366         mr_asprintf(&tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1367        mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13671368        if (!does_file_exist(tmp)) {
    13681369            mr_free(tmp);
    1369             mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1370            mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13701371            if (does_file_exist(tmp)) {
    13711372                log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir);
    1372                 sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir);
     1373                mr_free(bkpinfo->isodir);
     1374                mr_asprintf(p, "%s/isodir", bkpinfo->tmpdir);
     1375                bkpinfo->isodir = p;
    13731376            }
    13741377        }
     
    13841387                cd_number_i_want);
    13851388        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1386         mr_asprintf(&tmp, "Insisting on %s #%d", mds, cd_number_i_want);
    1387         mr_asprintf(&request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);
     1389        mr_asprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want);
     1390        mr_asprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);
    13881391        mr_free(mds);
    13891392        log_msg(3, tmp);
     
    14991502            }
    15001503            mds = media_descriptor_string(bkpinfo->backup_media_type);
    1501             mr_asprintf(&comment, "What speed is your %s (re)writer?", mds);
     1504            mr_asprintf(comment, "What speed is your %s (re)writer?", mds);
    15021505            if (bkpinfo->backup_media_type == dvd) {
    15031506                find_dvd_device(bkpinfo->media_device, FALSE);
    1504                 strcpy(tmp1, "1");
    1505                 mr_asprintf(&sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB
     1507                mr_asprintf(tmp, "1");
     1508                mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE);  // 4.7 salesman's GB = 4.482 real GB = 4482 MB
    15061509                log_msg(1, "Setting to DVD defaults");
    15071510            } else {
    15081511                strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM);
    1509                 strcpy(tmp1, "4");
    1510                 mr_asprintf(&sz_size, "%d", 650);
     1512                mr_asprintf(tmp, "4");
     1513                mr_asprintf(sz_size, "%d", 650);
    15111514                log_msg(1, "Setting to CD defaults");
    15121515            }
     
    15271530            bkpinfo->cdrw_speed = atoi(tmp1);   // if DVD then this shouldn't ever be used anyway :)
    15281531
    1529             mr_asprintf(&comment, "How much data (in Megabytes) will each %s store?", mds);
     1532            mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds);
    15301533            mr_free(mds);
    15311534            p = popup_and_get_string("Size", comment, sz_size);
     
    15671570                log_msg(1, "bkpinfo->media_device = %s",
    15681571                        bkpinfo->media_device);
    1569                 mr_asprintf(&comment, "Please specify your %s drive's /dev entry", mds);
     1572                mr_asprintf(comment, "Please specify your %s drive's /dev entry", mds);
    15701573                p = popup_and_get_string("Device?", comment, bkpinfo->media_device);
    15711574                mr_free(comment);
     
    15851588            if (bkpinfo->media_device[0]) {
    15861589                if (bkpinfo->backup_media_type == usb) {
    1587                     mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
     1590                    mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    15881591                } else {
    1589                     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);
     1592                    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);
    15901593                }
    15911594                if (!ask_me_yes_or_no(tmp)) {
     
    16481651        }
    16491652        if (bkpinfo->media_device[0]) {
    1650             mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
     1653            mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16511654            if (!ask_me_yes_or_no(tmp)) {
    16521655                bkpinfo->media_device[0] = '\0';
     
    16631666            mr_free(p);
    16641667        }
    1665         mr_asprintf(&tmp, "ls -l %s", bkpinfo->media_device);
     1668        mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device);
    16661669        if (run_program_and_log_output(tmp, FALSE)) {
    16671670            log_to_screen("User has not specified a valid /dev entry");
     
    17261729            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    17271730                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
    1728             mr_asprintf(&command, "mount | grep \"%s \" | cut -d' ' -f3",
    1729                     bkpinfo->nfs_mount);
    1730             strcpy(bkpinfo->isodir,
    1731                    call_program_and_get_last_line_of_output(command));
     1731            mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1732            mr_free(bkpinfo->isodir);
     1733            mr_asprintf(p, "%s", call_program_and_get_last_line_of_output(command));
     1734            bkpinfo->isodir = p;
    17321735            mr_free(command);
    17331736
    17341737            if (!bkpinfo->restore_data) {
    1735                 mr_asprintf(&comment, "How much data (in Megabytes) will each media store?");
     1738                mr_asprintf(comment, "How much data (in Megabytes) will each media store?");
    17361739                // BERLIOS: 4480 shouldn't be hardcoded here
    17371740                sz_size = popup_and_get_string("Size", comment, "4480");
     
    17421745                }
    17431746            } else {
    1744                 mr_asprintf(&sz_size, "0");
     1747                mr_asprintf(sz_size, "0");
    17451748            }
    17461749            for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
     
    17541757        }
    17551758        if (bkpinfo->disaster_recovery) {
    1756             mr_asprintf(&command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
     1759            mr_asprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
    17571760            (void)system(command);
    17581761            mr_free(command);
     
    17671770        }
    17681771        /* Initiate bkpinfo isodir path from running environment if mount already done */
     1772        mr_free(bkpinfo->isodir);
    17691773        if (is_this_device_mounted(bkpinfo->nfs_mount)) {
    1770             strcpy(bkpinfo->isodir,
    1771                    call_program_and_get_last_line_of_output
    1772                    ("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
     1774            mr_asprintf(p, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
     1775            bkpinfo->isodir = p;
     1776
    17731777        } else {
    1774             sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir);
    1775             mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir);
     1778            mr_asprintf(p, "%s/nfsdir", bkpinfo->tmpdir);
     1779            bkpinfo->isodir = p;
     1780            mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir);
    17761781            run_program_and_log_output(command, 5);
    17771782            mr_free(command);
    17781783
    1779             mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
     1784            mr_asprintf(tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    17801785            run_program_and_log_output(tmp, 3);
    17811786            mr_free(tmp);
     
    18201825                finish(1);
    18211826            }
    1822             strcpy(bkpinfo->isodir,p);
    1823             mr_free(p);
     1827            bkpinfo->isodir = p;
    18241828
    18251829            if (archiving_to_media) {
     
    19181922        bkpinfo->boot_loader = i;
    19191923        mr_free(bkpinfo->include_paths);
    1920         mr_asprintf(&p, "/");
     1924        mr_asprintf(p, "/");
    19211925        bkpinfo->include_paths = p;
    19221926
     
    19291933        bkpinfo->include_paths = p;
    19301934
    1931         mr_asprintf(&tmp, "%s", list_of_NFS_mounts_only());
     1935        mr_asprintf(tmp, "%s", list_of_NFS_mounts_only());
    19321936        if (strlen(tmp) > 2) {
    19331937            mr_strcat(bkpinfo->exclude_paths, " %s",tmp);
     
    19351939        mr_free(tmp);
    19361940// NTFS
    1937         strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    1938         if (strlen(tmp1) > 2) {
     1941        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};'"));
     1942        if (strlen(tmp) > 2) {
    19391943            p = popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp);
    19401944
     
    20082012#else
    20092013    if (bkpinfo->backup_media_type == nfs) {
    2010         log_msg(3, "I think the NFS mount is mounted at %s",
    2011                 bkpinfo->isodir);
     2014        log_msg(3, "I think the NFS mount is mounted at %s", bkpinfo->isodir);
    20122015    }
    20132016    log_it("isodir = %s", bkpinfo->isodir);
     
    20612064    static char result_sz[1024];
    20622065
    2063     mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2064     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;}'"));
     2066    mr_asprintf(exclude_these_directories,"%s",list_of_NFS_mounts_only());
     2067    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;}'"));
    20652068    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    20662069    mr_free(exclude_these_devices);
     
    20832086    static char result_sz[512];
    20842087
    2085     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;}'"));
     2088    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;}'"));
    20862089    snprintf(result_sz, 511, "%s", exclude_these_directories);
    20872090    mr_free(exclude_these_directories);
     
    21122115    make_hole_for_file(store_name_here);
    21132116    mkfifo(store_name_here, S_IRWXU | S_IRWXG);
    2114     mr_asprintf(&tmp, "chmod 770 %s", store_name_here);
     2117    mr_asprintf(tmp, "chmod 770 %s", store_name_here);
    21152118    paranoid_system(tmp);
    21162119    mr_free(tmp);
     
    21352138
    21362139#ifdef __FreeBSD__
    2137     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;}'"));
     2140    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;}'"));
    21382141#else
    2139     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;}'"));
     2142    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;}'"));
    21402143#endif
    21412144
    21422145    if (tmp[0] != '/') {
    2143         mr_asprintf(&sz, "%s", tmp);
     2146        mr_asprintf(sz, "%s", tmp);
    21442147        mr_free(tmp);
    2145         mr_asprintf(&tmp, "/%s", sz);
     2148        mr_asprintf(tmp, "/%s", sz);
    21462149        mr_free(sz);
    21472150    }
     
    21492152        fatal_error("I couldn't figure out the scratchdir!");
    21502153    }
    2151     mr_asprintf(&sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
     2154    mr_asprintf(sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
    21522155    mr_free(bkpinfo->scratchdir);
    21532156    bkpinfo->scratchdir = sz;
    21542157    log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);
    21552158
    2156     mr_asprintf(&command, "rm -Rf %s/mondo.scratch.*", tmp);
     2159    mr_asprintf(command, "rm -Rf %s/mondo.scratch.*", tmp);
    21572160    mr_free(tmp);
    21582161
     
    21922195        return (FALSE);
    21932196    }
    2194     mr_asprintf(&command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev);
     2197    mr_asprintf(command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev);
    21952198    if (!run_program_and_log_output(command, FALSE)
    21962199        && !run_program_and_log_output(command, FALSE)) {
     
    22272230//  log_it("Asking what_number_cd_is_this");
    22282231    if (g_ISO_restore_mode) {
    2229         mr_asprintf(&tmp, "mount | grep iso9660 | awk '{print $3;}'");
    2230 
    2231         mr_asprintf(&mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
     2232        mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'");
     2233
     2234        mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
    22322235        cd_number = atoi(last_line_of_file(mountdev));
    22332236        paranoid_free(mountdev);
     
    22372240    }
    22382241
    2239     mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
     2242    mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    22402243    if (!mountdev[0]) {
    22412244        log_it
     
    23702373    assert(which_device != NULL);
    23712374
    2372     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());
     2375    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());
    23732376    log_it("list_drives_cmd = %s", list_drives_cmd);
    23742377
     
    24122415    } else {
    24132416        // We need to look on each partition then
    2414         mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2417        mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    24152418        log_it("list_drives_cmd = %s", list_drives_cmd);
    24162419
     
    25132516        while (S_ISLNK(statbuf.st_mode)) {
    25142517            log_msg(1, "curr_fname = %s", curr_fname);
    2515             mr_asprintf(&command, "file %s", curr_fname);
    2516             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2518            mr_asprintf(command, "file %s", curr_fname);
     2519            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    25172520            mr_free(command);
    25182521            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    25192522                 p--);
    25202523            p++;
    2521             mr_asprintf(&scratch, "%s", p);
     2524            mr_asprintf(scratch, "%s", p);
    25222525            for (p = scratch; *p != '\0' && *p != '\''; p++);
    25232526            *p = '\0';
     
    25632566#endif
    25642567    log_msg(0, "Looking for partition table format type");
    2565     mr_asprintf(&fdisk, "/sbin/parted2fdisk");
     2568    mr_asprintf(fdisk, "/sbin/parted2fdisk");
    25662569    log_msg(1, "Using %s", fdisk);
    2567     mr_asprintf(&command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
     2570    mr_asprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    25682571    mr_free(fdisk);
    25692572
    2570     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2573    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    25712574    mr_free(command);
    25722575
  • branches/2.2.10/mondo/src/common/libmondo-fifo.c

    r2296 r2323  
    8888    for (bufsize = wise_upper_limit, res = -1;
    8989         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
    90         mr_asprintf(&tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');
     90        mr_asprintf(tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');
    9191        res = run_program_and_log_output(tmp, 2);
    9292        mr_free(tmp);
     
    9494    if (!res) {
    9595        bufsize++;
    96         mr_asprintf(&tmp, "Negotiated max buffer of %d MB ", bufsize);
     96        mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize);
    9797        log_to_screen(tmp);
    9898        mr_free(tmp);
     
    118118    }
    119119    log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer);
    120     mr_asprintf(&sz_dir, "%c", direction);
     120    mr_asprintf(sz_dir, "%c", direction);
    121121    fres = popen(g_sz_call_to_buffer, sz_dir);
    122122    mr_free(sz_dir);
     
    130130    }
    131131    sleep(2);
    132     mr_asprintf(&tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
     132    mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
    133133    if (run_program_and_log_output(tmp, 2)) {
    134134        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    136136    mr_free(tmp);
    137137    g_tape_buffer_size_MB = bufsize;
    138     mr_asprintf(&command, "ps %s | grep buffer | grep -v grep", ps_options);
     138    mr_asprintf(command, "ps %s | grep buffer | grep -v grep", ps_options);
    139139    if (run_program_and_log_output(command, 1)) {
    140140        fres = NULL;
     
    165165    }
    166166    paranoid_system("sync");
    167     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);
     167    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);
    168168    log_msg(2, "kill_buffer() --- command = %s", command);
    169     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     169    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    170170    mr_free(command);
    171171
    172     mr_asprintf(&command, "kill %s", tmp);
     172    mr_asprintf(command, "kill %s", tmp);
    173173    log_msg(2, "kill_buffer() --- command = %s", command);
    174174    if (strlen(tmp) > 0) {
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2321 r2323  
    9797    log_to_screen("Dividing filelist into sets. Please wait.");
    9898    i = 0;
    99     mr_asprintf(&filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);
     99    mr_asprintf(filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);
    100100    if (!does_file_exist(filelist)) {
    101101        log_it("filelist %s not found", filelist);
     
    108108    estimate_noof_media_required(noof_sets);    // for cosmetic purposes
    109109
    110     mr_asprintf(&tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
     110    mr_asprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
    111111    if (!(fout = fopen(tempfile, "a"))) {
    112112        log_OS_error("Cannot append to biggielist");
     
    158158    }                           // no sense in trying to sort an empty file
    159159
    160     mr_asprintf(&tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
    161 
    162     mr_asprintf(&command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
     160    mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
     161
     162    mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
    163163    retval = system(command);
    164164    mr_free(command);
     
    168168    } else {
    169169        log_msg(5, "Sorted %s --> %s OK. Copying it back to %s now", orig_fname, tmp_fname, orig_fname);
    170         mr_asprintf(&command, "mv -f %s %s", tmp_fname, orig_fname);
     170        mr_asprintf(command, "mv -f %s %s", tmp_fname, orig_fname);
    171171        retval += run_program_and_log_output(command, 5);
    172172        mr_free(command);
     
    240240    curr_set_no = 0;
    241241    curr_set_size = 0;
    242     mr_asprintf(&outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
    243     mr_asprintf(&biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir);
     242    mr_asprintf(outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
     243    mr_asprintf(biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir);
    244244    log_it("outfname=%s; biggie_fname=%s", outfname, biggie_fname);
    245245    if (!(fbig = fopen(biggie_fname, "w"))) {
     
    293293                curr_set_size = 0;
    294294
    295                 mr_asprintf(&outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
     295                mr_asprintf(outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
    296296                if (!(fout = fopen(outfname, "w"))) {
    297297                    log_OS_error("Unable to openout outfname");
     
    323323    mr_free(biggie_fname);
    324324
    325     mr_asprintf(&outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    326     mr_asprintf(&tmp, "%ld", curr_set_no);
     325    mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
     326    mr_asprintf(tmp, "%ld", curr_set_no);
    327327    if (write_one_liner_data_file(outfname, tmp)) {
    328328        log_OS_error
     
    334334
    335335    if (curr_set_no == 0) {
    336         mr_asprintf(&tmp, "Only one fileset. Fine.");
     336        mr_asprintf(tmp, "Only one fileset. Fine.");
    337337    } else {
    338         mr_asprintf(&tmp, "Filelist divided into %ld sets", curr_set_no + 1);
     338        mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1);
    339339    }
    340340    log_msg(1, tmp);
     
    453453        return (1);
    454454    }
    455     mr_asprintf(&pout_command, "gzip -c1 > %s", auxlist_fname);
     455    mr_asprintf(pout_command, "gzip -c1 > %s", auxlist_fname);
    456456    if (!(pout = popen(pout_command, "w"))) {
    457457        log_msg(1, "Cannot openout auxlist_fname %s", auxlist_fname);
     
    471471        log_msg(8, "Analyzing %s", file_to_analyze);
    472472        tmp = mr_stresc(file_to_analyze, "`$\\\"(){}[]'*?&|!#~", '\\');
    473         mr_asprintf(&strtmp, syscall_sprintf, tmp);
     473        mr_asprintf(strtmp, syscall_sprintf, tmp);
    474474        paranoid_free(tmp);
    475         mr_asprintf(&syscall, "%s 2>> /dev/null", strtmp);  // " MONDO_LOGFILE);
     475        mr_asprintf(syscall, "%s 2>> /dev/null", strtmp);   // " MONDO_LOGFILE);
    476476        paranoid_free(strtmp);
    477477        call_exe_and_pipe_output_to_fd(syscall, pout);
     
    491491
    492492    if (g_getfacl != NULL) {
    493         mr_asprintf(&command, "touch %s", facl_fname);
     493        mr_asprintf(command, "touch %s", facl_fname);
    494494        run_program_and_log_output(command, 8);
    495495        mr_free(command);
    496496
    497         mr_asprintf(&command, "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE);
     497        mr_asprintf(command, "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE);
    498498        log_it("%s",command);
    499499        retval = system(command);
     
    510510
    511511    if (g_getfattr != NULL) {
    512         mr_asprintf(&command, "touch %s", fattr_fname);
     512        mr_asprintf(command, "touch %s", fattr_fname);
    513513        run_program_and_log_output(command, 8);
    514514        mr_free(command);
     
    540540        || !does_file_exist(orig_msklist)) {
    541541        log_msg(1, "No masklist provided. I shall therefore set ALL attributes.");
    542         mr_asprintf(&command, "gzip -dc %s | %s --restore - 2>> %s", original_exat_fname, executable, MONDO_LOGFILE);
     542        mr_asprintf(command, "gzip -dc %s | %s --restore - 2>> %s", original_exat_fname, executable, MONDO_LOGFILE);
    543543        log_msg(1, "command = %s", command);
    544544        retval = system(command);
     
    554554    malloc_string(current_subset_file);
    555555    malloc_string(current_master_file);
    556     mr_asprintf(&masklist, "%s/masklist", bkpinfo->tmpdir);
    557     mr_asprintf(&command, "cp -f %s %s", orig_msklist, masklist);
     556    mr_asprintf(masklist, "%s/masklist", bkpinfo->tmpdir);
     557    mr_asprintf(command, "cp -f %s %s", orig_msklist, masklist);
    558558    run_program_and_log_output(command, 1);
    559559    mr_free(command);
     
    562562    current_subset_file[0] = current_master_file[0] = '\0';
    563563
    564     mr_asprintf(&syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
     564    mr_asprintf(syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
    565565    log_msg(1, "syscall_pout = %s", syscall_pout);
    566566    pout = popen(syscall_pout, "w");
     
    573573    }
    574574
    575     mr_asprintf(&syscall_pin, "gzip -dc %s", original_exat_fname);
     575    mr_asprintf(syscall_pin, "gzip -dc %s", original_exat_fname);
    576576    log_msg(1, "syscall_pin = %s", syscall_pin);
    577577    pin = popen(syscall_pin, "r");
     
    714714
    715715    strcpy(val_sz,"");
    716     mr_asprintf(&cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
     716    mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
    717717    read_cfg_var(cfg_fname, "last-filelist-number", val_sz);
    718718    mr_free(cfg_fname);
     
    876876    }
    877877    log_to_screen("Loading filelist");
    878     mr_asprintf(&tmp1, "zcat %s | wc -l", filelist_fname);
     878    mr_asprintf(tmp1, "zcat %s | wc -l", filelist_fname);
    879879    log_msg(6, "tmp1 = %s", tmp1);
    880880    lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp1));
     
    896896    (filelist->down)->expanded = (filelist->down)->selected = FALSE;
    897897
    898     mr_asprintf(&command_to_open_fname, "gzip -dc %s", filelist_fname);
     898    mr_asprintf(command_to_open_fname, "gzip -dc %s", filelist_fname);
    899899    if (!(pin = popen(command_to_open_fname, "r"))) {
    900900        log_OS_error("Unable to openin filelist_fname");
     
    13681368        malloc_string(name_of_evalcall_form);
    13691369        malloc_string(find_skeleton_marker);
    1370         mr_asprintf(&find_excludes, " ");
     1370        mr_asprintf(find_excludes, " ");
    13711371        if (sth != NULL) {
    13721372            while((token = mr_strtok(sth, delims, &lastpos))) {
     
    13771377#if linux
    13781378        // 2.6 has /sys as a proc-type thing -- must be excluded
    1379         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);
     1379        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);
    13801380#else
    13811381        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1382         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);
     1382        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);
    13831383#endif
    13841384        mr_free(find_excludes);
     
    13881388        mr_free(strtmp);
    13891389
    1390         mr_asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
     1390        mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    13911391        g_skeleton_entries = 1 + atol(call_program_and_get_last_line_of_output(tmp));
    13921392        mr_free(tmp);
     
    14141414#ifndef _XWIN
    14151415                if (!g_text_mode) {
    1416                     mr_asprintf(&tmp, "Reading %-68s", dir);
     1416                    mr_asprintf(tmp, "Reading %-68s", dir);
    14171417                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    14181418                    paranoid_free(tmp);
     
    14281428//  log_msg(0, "Cataloguing %s", dir);
    14291429    if (sth[0] == ' ') {
    1430         mr_asprintf(&skip_these, "%s", sth);
     1430        mr_asprintf(skip_these, "%s", sth);
    14311431    } else {
    1432         mr_asprintf(&skip_these, " %s ", sth);
    1433     }
    1434     mr_asprintf(&new_with_spaces, " %s ", dir);
     1432        mr_asprintf(skip_these, " %s ", sth);
     1433    }
     1434    mr_asprintf(new_with_spaces, " %s ", dir);
    14351435    if ((dip = opendir(dir)) == NULL) {
    1436         mr_asprintf(&tmp,"opendir %s", dir);
     1436        mr_asprintf(tmp,"opendir %s", dir);
    14371437        log_OS_error(tmp);
    14381438        paranoid_free(tmp);
     
    14441444            i++;
    14451445            if (strcmp(dir, "/")) {
    1446                 mr_asprintf(&new,"%s/%s",dir,dit->d_name);
     1446                mr_asprintf(new,"%s/%s",dir,dit->d_name);
    14471447            } else {
    1448                 mr_asprintf(&new,"%s%s",dir,dit->d_name);
     1448                mr_asprintf(new,"%s%s",dir,dit->d_name);
    14491449            }
    14501450            paranoid_free(new_with_spaces);
    1451             mr_asprintf(&new_with_spaces, " %s ", new);
     1451            mr_asprintf(new_with_spaces, " %s ", new);
    14521452            if (strstr(skip_these, new_with_spaces)) {
    14531453                fprintf(fout, "%s\n", new);
     
    14681468                                counter = 0;
    14691469                                uberctr++;
    1470                                 mr_asprintf(&tmp, " %c ", special_dot_char(uberctr));
     1470                                mr_asprintf(tmp, " %c ", special_dot_char(uberctr));
    14711471#ifndef _XWIN
    14721472                                if (!g_text_mode) {
     
    15211521    bool in_quotes = FALSE;
    15221522
    1523     mr_asprintf(&sz_res, "%s", incoming);
     1523    mr_asprintf(sz_res, "%s", incoming);
    15241524    p = sz_res;
    15251525    while ((*p != ' ' || in_quotes) && *p != '\0') {
     
    15631563    malloc_string(tmp);
    15641564    malloc_string(g_skeleton_filelist);
    1565     mr_asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
     1565    mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    15661566    if (!include_paths && !userdef_filelist) {
    15671567        fatal_error
     
    15691569    }
    15701570    // make hole for filelist
    1571     mr_asprintf(&command, "mkdir -p %s/archives", bkpinfo->scratchdir);
     1571    mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
    15721572    paranoid_system(command);
    15731573    mr_free(command);
    15741574
    1575     mr_asprintf(&sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
     1575    mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    15761576    make_hole_for_file(sz_filelist);
    15771577
    15781578    if (differential == 0) {
    15791579        // restore last good datefile if it exists
    1580         mr_asprintf(&command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
     1580        mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
    15811581        run_program_and_log_output(command, 3);
    15821582        mr_free(command);
     
    15841584        // backup last known good datefile just in case :)
    15851585        if (does_file_exist(sz_datefile)) {
    1586             mr_asprintf(&command, "mv -f %s %s.aborted", sz_datefile,
     1586            mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile,
    15871587                    sz_datefile);
    15881588            paranoid_system(command);
     
    16091609                "Using the user-specified filelist - %s - instead of calculating one",
    16101610                userdef_filelist);
    1611         mr_asprintf(&command, "cp -f %s %s", userdef_filelist, sz_filelist);
     1611        mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);
    16121612        if (run_program_and_log_output(command, 3)) {
    16131613            mr_free(command);
     
    16201620        }
    16211621        log_msg(1, "Calculating filelist");
    1622         mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1622        mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
    16231623        if (strlen(tmp2) < 1) {
    1624             mr_asprintf(&tmp1," ");
     1624            mr_asprintf(tmp1," ");
    16251625        } else {
    16261626            log_msg(2, "Found windows FS: %s",tmp2);
    1627             mr_asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1627            mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    16281628            paranoid_free(tmp2);
    1629             mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1629            mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    16301630            log_msg(2, "Found windows files: %s",tmp2);
    16311631        }
    16321632        mr_free(tmp1);
    16331633
    1634         mr_asprintf(&exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);
     1634        mr_asprintf(exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);
    16351635        mr_free(tmp2);
    16361636
     
    16671667    }
    16681668    log_msg(2, "Copying new filelist to scratchdir");
    1669     mr_asprintf(&command, "mkdir -p %s/archives", bkpinfo->scratchdir);
     1669    mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
    16701670    paranoid_system(command);
    16711671    mr_free(command);
    16721672
    1673     mr_asprintf(&command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);
     1673    mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);
    16741674    paranoid_system(command);
    16751675    mr_free(command);
    16761676
    1677     mr_asprintf(&command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);
     1677    mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);
    16781678    paranoid_system(command);
    16791679    mr_free(command);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2321 r2323  
    6262    assert_string_is_neither_NULL_nor_zerolength(filename);
    6363    if (does_file_exist(filename)) {
    64         mr_asprintf(&command, "md5sum \"%s\"", filename);
     64        mr_asprintf(command, "md5sum \"%s\"", filename);
    6565        fin = popen(command, "r");
    6666        if (fin) {
     
    7171        mr_free(command);
    7272    } else {
    73         mr_asprintf(&tmp, "File '%s' not found; cannot calc checksum", filename);
     73        mr_asprintf(tmp, "File '%s' not found; cannot calc checksum", filename);
    7474        log_it(tmp);
    7575        mr_free(tmp);
     
    142142    assert_string_is_neither_NULL_nor_zerolength(filename);
    143143    if (!does_file_exist(filename)) {
    144         mr_asprintf(&tmp, "%s does not exist, so I cannot found the number of lines in it", filename);
     144        mr_asprintf(tmp, "%s does not exist, so I cannot found the number of lines in it", filename);
    145145        log_it(tmp);
    146146        mr_free(tmp);
    147147        return (0);
    148148    }
    149     mr_asprintf(&command, "cat %s | wc -l", filename);
     149    mr_asprintf(command, "cat %s | wc -l", filename);
    150150    if (!does_file_exist(filename)) {
    151151        mr_free(command);
     
    224224
    225225    assert_string_is_neither_NULL_nor_zerolength(inout);
    226     mr_asprintf(&infname, "%s.in", inout);
    227     mr_asprintf(&outfname, "%s", inout);
    228     mr_asprintf(&tmp, "cp -f %s %s", inout, infname);
     226    mr_asprintf(infname, "%s.in", inout);
     227    mr_asprintf(outfname, "%s", inout);
     228    mr_asprintf(tmp, "cp -f %s %s", inout, infname);
    229229    run_program_and_log_output(tmp, FALSE);
    230230    mr_free(tmp);
     
    251251            fprintf(fout, "%s\n", incoming);
    252252        } else {
    253             mr_asprintf(&tmp, "Excluding '%s'-nonexistent\n", incoming);
     253            mr_asprintf(tmp, "Excluding '%s'-nonexistent\n", incoming);
    254254            log_it(tmp);
    255255            mr_free(tmp);
     
    289289    // If we didn't get anything back, check whether mindi raised a fatal error
    290290    if (!kernel[0]) {
    291         mr_asprintf(&command, "%s", "grep 'Fatal error' /var/log/mindi.log");
    292         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     291        mr_asprintf(command, "%s", "grep 'Fatal error' /var/log/mindi.log");
     292        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    293293        if (strlen(tmp) > 1) {
    294294            popup_and_OK(tmp);
     
    344344
    345345    assert_string_is_neither_NULL_nor_zerolength(fname);
    346     mr_asprintf(&command, "which %s 2> /dev/null", fname);
     346    mr_asprintf(command, "which %s 2> /dev/null", fname);
    347347    strcpy(incoming, call_program_and_get_last_line_of_output(command));
    348348    mr_free(command);
     
    353353            return (NULL);      // forget it :)
    354354        }
    355         mr_asprintf(&command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming);
     355        mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming);
    356356        strcpy(incoming,
    357357               call_program_and_get_last_line_of_output(command));
     
    360360    if (incoming[0] == '\0')    // yes, it is == '\0' twice, not once :)
    361361    {
    362         mr_asprintf(&command, "dirname %s 2> /dev/null", incoming);
     362        mr_asprintf(command, "dirname %s 2> /dev/null", incoming);
    363363        strcpy(incoming,
    364364               call_program_and_get_last_line_of_output(command));
     
    452452         && !strstr(err_log_lines[i], "% done"); i--);
    453453    if (i < 0) {
    454         mr_asprintf(&command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');
     454        mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');
    455455        strcpy(lastline,
    456456               call_program_and_get_last_line_of_output(command));
     
    503503
    504504    if (!does_file_exist(filename)) {
    505         mr_asprintf(&tmp, "Tring to get last line of nonexistent file (%s)", filename);
     505        mr_asprintf(tmp, "Tring to get last line of nonexistent file (%s)", filename);
    506506        log_it(tmp);
    507507        mr_free(tmp);
     
    509509        return (output);
    510510    }
    511     mr_asprintf(&command, "tail -n1 %s", filename);
     511    mr_asprintf(command, "tail -n1 %s", filename);
    512512    fin = popen(command, "r");
    513513    mr_free(command);
     
    602602            stub_fname[i] = '\0';
    603603        }
    604         mr_asprintf(&tmp, "%s%s", comppath, stub_fname);
     604        mr_asprintf(tmp, "%s%s", comppath, stub_fname);
    605605        strcpy(curr_fname, tmp + 1);
    606606        mr_free(tmp);
     
    620620                time_remaining =
    621621                    time_taken * 100 / (long) (percentage) - time_taken;
    622                 mr_asprintf(&tmp, "%02d%% done   %02d:%02d taken   %02d:%02d remaining  %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname);
     622                mr_asprintf(tmp, "%02d%% done   %02d:%02d taken   %02d:%02d remaining  %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname);
    623623                log_to_screen(tmp);
    624624                mr_free(tmp);
     
    645645
    646646    assert_string_is_neither_NULL_nor_zerolength(outdir_fname);
    647     mr_asprintf(&tmp, "mkdir -p %s", outdir_fname);
     647    mr_asprintf(tmp, "mkdir -p %s", outdir_fname);
    648648    res = system(tmp);
    649649    mr_free(tmp);
     
    671671    assert(!strstr(outfile_fname, MNT_CDROM));
    672672    assert(!strstr(outfile_fname, "/dev/cdrom"));
    673     mr_asprintf(&command, "mkdir -p \"%s\" 2> /dev/null", outfile_fname);
     673    mr_asprintf(command, "mkdir -p \"%s\" 2> /dev/null", outfile_fname);
    674674    res += system(command);
    675675    mr_free(command);
    676676
    677     mr_asprintf(&command, "rmdir \"%s\" 2> /dev/null", outfile_fname);
     677    mr_asprintf(command, "rmdir \"%s\" 2> /dev/null", outfile_fname);
    678678    res += system(command);
    679679    mr_free(command);
    680680
    681     mr_asprintf(&command, "rm -f \"%s\" 2> /dev/null", outfile_fname);
     681    mr_asprintf(command, "rm -f \"%s\" 2> /dev/null", outfile_fname);
    682682    res += system(command);
    683683    mr_free(command);
     
    742742    long file_len_K;
    743743
    744     mr_asprintf(&mountlist, "%s/mountlist.txt", tmpdir);
    745     mr_asprintf(&command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);
     744    mr_asprintf(mountlist, "%s/mountlist.txt", tmpdir);
     745    mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);
    746746    mr_free(mountlist);
    747747
     
    782782    malloc_string(fname);
    783783    log_it("Calculating size of all biggiefiles (in total)");
    784     mr_asprintf(&biggielist, "%s/biggielist.txt", bkpinfo->tmpdir);
     784    mr_asprintf(biggielist, "%s/biggielist.txt", bkpinfo->tmpdir);
    785785    log_it("biggielist = %s", biggielist);
    786786    fin = fopen(biggielist, "r");
     
    801801                        fatal_error("ntfsresize not found");
    802802                    }
    803                     mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname);
     803                    mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname);
    804804                    log_it("command = %s", command);
    805                     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     805                    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    806806                    mr_free(command);
    807807
     
    820820                log_msg(4, "%s --> %ld K", fname, file_len_K);
    821821            }
    822             mr_asprintf(&comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);
     822            mr_asprintf(comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);
    823823            log_msg(4, comment);
    824824            mr_free(comment);
     
    853853    /*@ end vars *************************************************** */
    854854
    855     mr_asprintf(&command, "du -sk %s", mountpt);
     855    mr_asprintf(command, "du -sk %s", mountpt);
    856856    errno = 0;
    857857    fin = popen(command, "r");
     
    923923    int res = 0;
    924924
    925     mr_asprintf(&command, "which %s > /dev/null 2> /dev/null", fname);
     925    mr_asprintf(command, "which %s > /dev/null 2> /dev/null", fname);
    926926    res = system(command);
    927927    mr_free(command);
    928928
    929929    if (res) {
    930         mr_asprintf(&errorstr, "Please install '%s'. I cannot find it on your system.", fname);
     930        mr_asprintf(errorstr, "Please install '%s'. I cannot find it on your system.", fname);
    931931        log_to_screen(errorstr);
    932932        mr_free(errorstr);
     
    10411041        find_and_store_mondoarchives_home(g_mondo_home);
    10421042    }
    1043     mr_asprintf(&command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir);
     1043    mr_asprintf(command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir);
    10441044
    10451045    log_msg(4, "command = %s", command);
     
    10511051    }
    10521052
    1053     mr_asprintf(&command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
     1053    mr_asprintf(command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
    10541054    res = run_program_and_log_output(command, FALSE);
    10551055    mr_free(command);
     
    10651065            ("'which mondorestore' returned null. Where's your mondorestore? `which` can't find it. That's odd. Did you install mondorestore?");
    10661066    }
    1067     mr_asprintf(&command, "cp -f %s %s", tmp, bkpinfo->tmpdir);
     1067    mr_asprintf(command, "cp -f %s %s", tmp, bkpinfo->tmpdir);
    10681068    res = run_program_and_log_output(command, FALSE);
    10691069    mr_free(command);
     
    10731073    }
    10741074
    1075     mr_asprintf(&command, "hostname > %s/HOSTNAME", bkpinfo->scratchdir);
     1075    mr_asprintf(command, "hostname > %s/HOSTNAME", bkpinfo->scratchdir);
    10761076    paranoid_system(command);
    10771077    mr_free(command);
    10781078
    10791079    if (bkpinfo->postnuke_tarball[0]) {
    1080         mr_asprintf(&command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir);
     1080        mr_asprintf(command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir);
    10811081        res = run_program_and_log_output(command, FALSE);
    10821082        mr_free(command);
     
    11211121
    11221122    log_it("Storing NFS configuration");
    1123     mr_asprintf(&tmp, "%s", bkpinfo->nfs_mount);
     1123    mr_asprintf(tmp, "%s", bkpinfo->nfs_mount);
    11241124    p = strchr(tmp, ':');
    11251125    if (!p) {
     
    11281128    }
    11291129    *(p++) = '\0';
    1130     mr_asprintf(&nfs_server_ipaddr, "%s", tmp);
    1131     mr_asprintf(&nfs_mount, "%s", p);
     1130    mr_asprintf(nfs_server_ipaddr, "%s", tmp);
     1131    mr_asprintf(nfs_mount, "%s", p);
    11321132    mr_free(tmp);
    11331133
    11341134    /* BERLIOS : there is a bug #67 here as it only considers the first NIC */
    1135     mr_asprintf(&command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
    1136     mr_asprintf(&nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    1137     mr_free(command);
    1138 
    1139     mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
    1140     mr_asprintf(&nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
    1141     mr_free(command);
    1142 
    1143     mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");
    1144     mr_asprintf(&nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
    1145     mr_free(command);
    1146 
    1147     mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
    1148     mr_asprintf(&nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
    1149     mr_free(command);
    1150 
    1151     mr_asprintf(&command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");
    1152     mr_asprintf(&nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
     1135    mr_asprintf(command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
     1136    mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1137    mr_free(command);
     1138
     1139    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
     1140    mr_asprintf(nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
     1141    mr_free(command);
     1142
     1143    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");
     1144    mr_asprintf(nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
     1145    mr_free(command);
     1146
     1147    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
     1148    mr_asprintf(nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
     1149    mr_free(command);
     1150
     1151    mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");
     1152    mr_asprintf(nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
    11531153    mr_free(command);
    11541154
     
    11681168    if (!strncmp(nfs_dev, "bond", 4) || !strncmp(nfs_dev, "alb", 3) || !strncmp(nfs_dev, "aft", 3)) {
    11691169        log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", nfs_dev);
    1170         mr_asprintf(&command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev);
    1171         mr_asprintf(&mac_addr, "%s", call_program_and_get_last_line_of_output(command));
     1170        mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev);
     1171        mr_asprintf(mac_addr, "%s", call_program_and_get_last_line_of_output(command));
    11721172        mr_free(command);
    11731173
    1174         mr_asprintf(&command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev);
     1174        mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev);
    11751175        mr_free(mac_addr);
    11761176        mr_free(nfs_dev);
    11771177
    1178         mr_asprintf(&nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1178        mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    11791179        mr_free(command);
    11801180
     
    11821182    }
    11831183
    1184     mr_asprintf(&tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
     1184    mr_asprintf(tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
    11851185    write_one_liner_data_file(tmp, nfs_dev);
    11861186    mr_free(nfs_dev);
    11871187    mr_free(tmp);
    11881188
    1189     mr_asprintf(&tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
     1189    mr_asprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    11901190    write_one_liner_data_file(tmp, nfs_client_ipaddr);
    11911191    mr_free(nfs_client_ipaddr);
    11921192    mr_free(tmp);
    11931193
    1194     mr_asprintf(&tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
     1194    mr_asprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    11951195    write_one_liner_data_file(tmp, nfs_client_netmask);
    11961196    mr_free(nfs_client_netmask);
    11971197    mr_free(tmp);
    11981198
    1199     mr_asprintf(&tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
     1199    mr_asprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    12001200    write_one_liner_data_file(tmp, nfs_client_broadcast);
    12011201    mr_free(nfs_client_broadcast);
    12021202    mr_free(tmp);
    12031203
    1204     mr_asprintf(&tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
     1204    mr_asprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    12051205    write_one_liner_data_file(tmp, nfs_client_defgw);
    12061206    mr_free(nfs_client_defgw);
    12071207    mr_free(tmp);
    12081208
    1209     mr_asprintf(&tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
     1209    mr_asprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    12101210    write_one_liner_data_file(tmp, nfs_server_ipaddr);
    12111211    mr_free(tmp);
    12121212    mr_free(nfs_server_ipaddr);
    12131213
    1214     mr_asprintf(&tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
     1214    mr_asprintf(tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
    12151215    write_one_liner_data_file(tmp, bkpinfo->nfs_mount);
    12161216    mr_free(tmp);
    12171217    mr_free(nfs_mount);
    12181218
    1219     mr_asprintf(&tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
     1219    mr_asprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    12201220    write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir);
    12211221    mr_free(tmp);
    12221222
    1223     mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
     1223    mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    12241224    write_one_liner_data_file(tmp, bkpinfo->prefix);
    12251225    mr_free(tmp);
     
    12821282    if (scratchLL <= 1) {
    12831283        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1284         mr_asprintf(&tmp, "Your backup will probably occupy a single %s. Maybe two.", mds);
     1284        mr_asprintf(tmp, "Your backup will probably occupy a single %s. Maybe two.", mds);
    12851285        mr_free(mds);
    12861286    } else if (scratchLL > 4) {
    1287         mr_asprintf(&tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1)));
     1287        mr_asprintf(tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1)));
    12881288    } else {
    1289         mr_asprintf(&tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1)));
     1289        mr_asprintf(tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1)));
    12901290    }
    12911291    if (!bkpinfo->image_devs[0] && (scratchLL < 50)) {
     
    13361336    }
    13371337
    1338     mr_asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home);
     1338    mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    13391339    if (!does_file_exist(tmp)) {
    13401340        mr_free(tmp);
     
    13461346
    13471347    for (p = do_not_compress_these; p != NULL; p++) {
    1348         mr_asprintf(&tmp, "%s", p);
     1348        mr_asprintf(tmp, "%s", p);
    13491349        if (strchr(tmp, ' ')) {
    13501350            *(strchr(tmp, ' ')) = '\0';
     
    13941394        paranoid_fclose(fout);
    13951395        log_msg(2, "Created %s", outfile);
    1396         mr_asprintf(&tmp, "chmod +x %s", outfile);
     1396        mr_asprintf(tmp, "chmod +x %s", outfile);
    13971397        paranoid_system(tmp);
    13981398        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-fork.c

    r2316 r2323  
    125125
    126126    if (bkpinfo->nfs_user) {
    127         mr_asprintf(&tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
     127        mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
    128128    } else {
    129         mr_asprintf(&tmp1, "%s", basic_call);
    130     }
    131 
    132     mr_asprintf(&cd_number_str, "%d", cd_no);
     129        mr_asprintf(tmp1, "%s", basic_call);
     130    }
     131
     132    mr_asprintf(cd_number_str, "%d", cd_no);
    133133    log_msg(4, "basic call = '%s'", tmp1);
    134134    midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_");
     
    145145
    146146    log_msg(4, "ultimate call = '%s'", ultimate_call);
    147     mr_asprintf(&command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
     147    mr_asprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
    148148    mr_free(ultimate_call);
    149149
     
    153153            what_i_am_doing);
    154154    if (bkpinfo->manual_cd_tray) {
    155         mr_asprintf(&tmp2, "%s", command);
     155        mr_asprintf(tmp2, "%s", command);
    156156        p = strstr(tmp2, "2>>");
    157157        if (p) {
     
    272272        log_if_failure = TRUE;
    273273    }
    274     mr_asprintf(&callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
     274    mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
    275275    while ((p = strchr(callstr, '\r'))) {
    276276        *p = ' ';
     
    288288    mr_free(callstr);
    289289
    290     mr_asprintf(&callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
     290    mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
    291291    if (log_if_failure && system(callstr)) {
    292292        log_OS_error("Command failed");
     
    294294    mr_free(callstr);
    295295
    296     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
     296    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
    297297    unlink(tmp1);
    298298    mr_free(tmp1);
    299299
    300     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
     300    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
    301301    fin = fopen(tmp1, "r");
    302302    if (fin) {
     
    363363    assert_string_is_neither_NULL_nor_zerolength(basic_call);
    364364
    365     mr_asprintf(&lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
    366 
    367     mr_asprintf(&command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
     365    mr_asprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
     366
     367    mr_asprintf(command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
    368368    open_evalcall_form(what_i_am_doing);
    369     mr_asprintf(&tmp, "Executing %s", basic_call);
     369    mr_asprintf(tmp, "Executing %s", basic_call);
    370370    log_msg(2, tmp);
    371371    mr_free(tmp);
     
    373373    if (!(fin = popen(command, "r"))) {
    374374        log_OS_error("Unable to popen-in command");
    375         mr_asprintf(&tmp, "Failed utterly to call '%s'", command);
     375        mr_asprintf(tmp, "Failed utterly to call '%s'", command);
    376376        log_to_screen(tmp);
    377377        mr_free(tmp);
     
    463463        fin = f_orig;
    464464        fout = f_archived;
    465         mr_asprintf(&tmp, "%-64s", PIMP_START_SZ);
     465        mr_asprintf(tmp, "%-64s", PIMP_START_SZ);
    466466        if (fwrite(tmp, 1, 64, fout) != 64) {
    467467            mr_free(tmp);
     
    475475                break;
    476476            }
    477             mr_asprintf(&tmp, "%-64ld", bytes_read_in);
     477            mr_asprintf(tmp, "%-64ld", bytes_read_in);
    478478            if (fwrite(tmp, 1, 64, fout) != 64) {
    479479                mr_free(tmp);
     
    486486                    subsliceno, bytes_read_in, bytes_to_be_read);
    487487            bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
    488             mr_asprintf(&tmp, "%-64ld", subsliceno);
     488            mr_asprintf(tmp, "%-64ld", subsliceno);
    489489            if (fwrite(tmp, 1, 64, fout) != 64) {
    490490                mr_free(tmp);
     
    495495            subsliceno++;
    496496        }
    497         mr_asprintf(&tmp, "%-64ld", 0L);
     497        mr_asprintf(tmp, "%-64ld", 0L);
    498498        if (fwrite(tmp, 1, 64L, fout) != 64L) {
    499499            mr_free(tmp);
     
    502502        mr_free(tmp);
    503503
    504         mr_asprintf(&tmp, "%-64s", PIMP_END_SZ);
     504        mr_asprintf(tmp, "%-64s", PIMP_END_SZ);
    505505        if (fwrite(tmp, 1, 64, fout) != 64) {
    506506            mr_free(tmp);
     
    559559            log_msg(5, "tmpB is %s", tmp1);
    560560            if (!strstr(tmp1, PIMP_END_SZ)) {
    561                 mr_asprintf(&filestr, "%s/out.leftover", bkpinfo->tmpdir);
     561                mr_asprintf(filestr, "%s/out.leftover", bkpinfo->tmpdir);
    562562                ftmp = fopen(filestr, "w");
    563563                mr_free(filestr);
     
    604604        fatal_error("ntfsclone not found");
    605605    }
    606     mr_asprintf(&command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
     606    mr_asprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
    607607    res = run_program_and_log_output(command, 5);
    608608    mr_free(command);
     
    659659    malloc_string(title);
    660660    strcpy(title, tt);
    661     mr_asprintf(&command, "%s 2>> %s", cmd, MONDO_LOGFILE);
     661    mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);
    662662    log_msg(3, "command = '%s'", command);
    663663    if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) {
     
    719719        fatal_error("ntfsclone not found");
    720720    }
    721     mr_asprintf(&command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
     721    mr_asprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
    722722    res = run_program_and_log_output(command, 5);
    723723    mr_free(command);
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2316 r2323  
    7373    /*@ initialize ***************************************************** */
    7474    prev_part_no = 0;
    75     mr_asprintf(&flaws_str, "%s", "");
     75    mr_asprintf(flaws_str, "%s", "");
    7676
    7777
     
    7979
    8080    if (physical_drive_size < 0) {
    81         mr_asprintf(&tmp, " %s does not exist.", drive);
     81        mr_asprintf(tmp, " %s does not exist.", drive);
    8282        mr_strcat(flaws_str, "%s", tmp);
    8383    } else {
    84         mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size);
     84        mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    8585    }
    8686    log_it(tmp);
     
    9090    /* check DD */
    9191    for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) {
    92         mr_asprintf(&device, "%s%c", drive, cur_sp_no);
     92        mr_asprintf(device, "%s%c", drive, cur_sp_no);
    9393        if (find_device_in_mountlist(mountlist, device) >= 0) {
    9494            foundsome = TRUE;
     
    9898    if (foundsome) {
    9999        for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) {
    100             mr_asprintf(&device, "%s%c", drive, cur_sp_no);
     100            mr_asprintf(device, "%s%c", drive, cur_sp_no);
    101101            pos = find_device_in_mountlist(mountlist, device);
    102102            if (pos < 0) {
     
    107107            /* is it too big? */
    108108            if (curr_part_no > 'h') {
    109                 mr_asprintf(&tmp, " Can only have up to 'h' in disklabel.");
     109                mr_asprintf(tmp, " Can only have up to 'h' in disklabel.");
    110110                log_it(tmp);
    111111                mr_strcat(flaws_str, tmp);
     
    121121            }
    122122            if (device_copies > 1) {
    123                 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     123                mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    124124                if (!strstr(flaws_str, tmp)) {
    125125                    log_it(tmp);
     
    132132            if (mountlist->el[pos].size < 8192
    133133                && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    134                 mr_asprintf(&tmp, " %s is tiny!", device);
     134                mr_asprintf(tmp, " %s is tiny!", device);
    135135                log_it(tmp);
    136136                mr_strcat(flaws_str, tmp);
     
    145145                && strcmp(mountlist->el[pos].mountpoint, "none")
    146146                && mountlist->el[pos].mountpoint[0] != '/') {
    147                 mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     147                mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    148148                log_it(tmp);
    149149                mr_strcat(flaws_str, tmp);
     
    153153            /* is format sensible? */
    154154            if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    155                 mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     155                mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    156156                log_it(tmp);
    157157                mr_strcat(flaws_str, tmp);
     
    172172        npos = 0;
    173173        for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) {
    174             mr_asprintf(&tmp, "%ss%i%c", device, curr_part_no, cur_sp_no);
     174            mr_asprintf(tmp, "%ss%i%c", device, curr_part_no, cur_sp_no);
    175175            if (find_device_in_mountlist(mountlist, tmp) >= 0) {
    176176                npos++;
     
    191191            if (curr_part_no - prev_part_no > 1) {
    192192                if (prev_part_no == 0) {
    193                     mr_asprintf(&tmp, " Gap prior to %s.", device);
     193                    mr_asprintf(tmp, " Gap prior to %s.", device);
    194194                    log_it(tmp);
    195195                    mr_strcat(flaws_str, "%s", tmp);
     
    198198                } else if (curr_part_no > 5
    199199                           || (curr_part_no <= 4 && prev_part_no > 0)) {
    200                     mr_asprintf(&tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);
     200                    mr_asprintf(tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);
    201201                    log_it(tmp);
    202202                    mr_strcat(flaws_str, "%s", tmp);
     
    210210            if ((curr_part_no >= 5 && prev_part_no == 4)
    211211                && (strcmp(part_table_fmt, "MBR") == 0)) {
    212                 mr_asprintf(&tmp, " Partition %ss4 is occupied.", drive);
     212                mr_asprintf(tmp, " Partition %ss4 is occupied.", drive);
    213213                log_it(tmp);
    214214                mr_strcat(flaws_str, "%s", tmp);
     
    224224            }
    225225            if (device_copies > 1) {
    226                 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     226                mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    227227                if (!strstr(flaws_str, "%s", tmp)) {
    228228                    log_it(tmp);
     
    235235            if (mountlist->el[pos].size < 8192
    236236                && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    237                 mr_asprintf(&tmp, " %s is tiny!", device);
     237                mr_asprintf(tmp, " %s is tiny!", device);
    238238                log_it(tmp);
    239239                mr_strcat(flaws_str, "%s", tmp);
     
    248248                && strcmp(mountlist->el[pos].mountpoint, "none")
    249249                && mountlist->el[pos].mountpoint[0] != '/') {
    250                 mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     250                mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    251251                log_it(tmp);
    252252                mr_strcat(flaws_str, "%s", tmp);
     
    256256            /* is format sensible? */
    257257            if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    258                 mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     258                mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    259259                log_it(tmp);
    260260                mr_strcat(flaws_str, "%s", tmp);
     
    274274                /* is it too big? */
    275275                if (curr_part_no > 'h') {
    276                     mr_asprintf(&tmp, " Can only have up to 'h' in disklabel.");
     276                    mr_asprintf(tmp, " Can only have up to 'h' in disklabel.");
    277277                    log_it(tmp);
    278278                    mr_strcat(flaws_str, "%s", tmp);
     
    288288                }
    289289                if (device_copies > 1) {
    290                     mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     290                    mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    291291                    if (!strstr(flaws_str, tmp)) {
    292292                        log_it(tmp);
     
    299299                if (mountlist->el[pos].size < 8192
    300300                    && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    301                     mr_asprintf(&tmp, " %s is tiny!", device);
     301                    mr_asprintf(tmp, " %s is tiny!", device);
    302302                    log_it(tmp);
    303303                    mr_strcat(flaws_str, "%s", tmp);
     
    312312                    && strcmp(mountlist->el[pos].mountpoint, "none")
    313313                    && mountlist->el[pos].mountpoint[0] != '/') {
    314                     mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     314                    mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    315315                    log_it(tmp);
    316316                    mr_strcat(flaws_str, "%s", tmp);
     
    321321                if (!is_this_a_valid_disk_format
    322322                    (mountlist->el[pos].format)) {
    323                     mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     323                    mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    324324                    log_it(tmp);
    325325                    mr_strcat(flaws_str, "%s", tmp);
     
    341341    if (amount_allocated > physical_drive_size) // Used to be +1, but what if you're 1 MB too high?
    342342    {
    343         mr_asprintf(&tmp, " %ld MB over-allocated on %s.",
     343        mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    344344                amount_allocated - physical_drive_size, drive);
    345345        log_it(tmp);
     
    348348        res++;
    349349    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    350         mr_asprintf(&tmp, " %ld MB unallocated on %s.",
     350        mr_asprintf(tmp, " %ld MB unallocated on %s.",
    351351                physical_drive_size - amount_allocated, drive);
    352352        log_it(tmp);
     
    389389    assert_string_is_neither_NULL_nor_zerolength(drive);
    390390    assert(mountlist != NULL);
    391     mr_asprintf(&flaws_str, "%s", "");
     391    mr_asprintf(flaws_str, "%s", "");
    392392
    393393    prev_part_no = 0;
     
    396396
    397397    if (physical_drive_size < 0) {
    398         mr_asprintf(&tmp, " %s does not exist.", drive);
     398        mr_asprintf(tmp, " %s does not exist.", drive);
    399399        mr_strcat(flaws_str, "%s", tmp);
    400400        res++;
     
    403403        return(flaws_str);
    404404    } else {
    405         mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size);
     405        mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    406406        log_it(tmp);
    407407        mr_free(tmp);
     
    417417        if (curr_part_no - prev_part_no > 1) {
    418418            if (prev_part_no == 0) {
    419                 mr_asprintf(&tmp, " Gap prior to %s.", device);
     419                mr_asprintf(tmp, " Gap prior to %s.", device);
    420420                log_it(tmp);
    421421                mr_strcat(flaws_str, "%s", tmp);
     
    424424            } else if (curr_part_no > 5
    425425                       || (curr_part_no <= 4 && prev_part_no > 0)) {
    426                 mr_asprintf(&tmp, " Gap on %s between %d and %d.", drive,
     426                mr_asprintf(tmp, " Gap on %s between %d and %d.", drive,
    427427                        prev_part_no, curr_part_no);
    428428                log_it(tmp);
     
    437437        if ((curr_part_no >= 5 && prev_part_no == 4)
    438438            && (strcmp(part_table_fmt, "MBR") == 0)) {
    439             mr_asprintf(&tmp, " Partition 4 of %s is occupied.", drive);
     439            mr_asprintf(tmp, " Partition 4 of %s is occupied.", drive);
    440440            log_it(tmp);
    441441            mr_strcat(flaws_str, "%s", tmp);
     
    451451        }
    452452        if (device_copies > 1) {
    453             mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     453            mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    454454            if (!strstr(flaws_str, tmp)) {
    455455                log_it(tmp);
     
    462462        if (mountlist->el[pos].size < 8192
    463463            && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    464             mr_asprintf(&tmp, " %s is tiny!", device);
     464            mr_asprintf(tmp, " %s is tiny!", device);
    465465            log_it(tmp);
    466466            mr_strcat(flaws_str, "%s", tmp);
     
    474474            && strcmp(mountlist->el[pos].mountpoint, "image")
    475475            && mountlist->el[pos].mountpoint[0] != '/') {
    476             mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     476            mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    477477            log_it(tmp);
    478478            mr_strcat(flaws_str, "%s", tmp);
     
    482482        /* is format sensible? */
    483483        if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    484             mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     484            mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    485485            log_it(tmp);
    486486            mr_strcat(flaws_str, "%s", tmp);
     
    496496    /* Over-allocated the disk? Unallocated space on disk? */
    497497    if (amount_allocated > physical_drive_size + 1) {
    498         mr_asprintf(&tmp, " %ld MB over-allocated on %s.",
     498        mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    499499                amount_allocated - physical_drive_size, drive);
    500500        log_it(tmp);
     
    503503        res++;
    504504    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    505         mr_asprintf(&tmp, " %ld MB unallocated on %s.",
     505        mr_asprintf(tmp, " %ld MB unallocated on %s.",
    506506                physical_drive_size - amount_allocated, drive);
    507507        log_it(tmp);
     
    551551    assert(flaws_str_C != NULL);
    552552
    553     mr_asprintf(&flaws_str, "%s", "");
     553    mr_asprintf(flaws_str, "%s", "");
    554554
    555555    make_list_of_drives_in_mountlist(mountlist, drivelist);
     
    561561            (drivelist->el[i].device,
    562562             DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) {
    563             mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
     563            mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
    564564            log_it(tmp);
    565565            paranoid_free(tmp);
     
    639639
    640640    for (currline = 0; currline < mountlist->entries; currline++) {
    641         mr_asprintf(&curr_mountpoint, "%s", mountlist->el[currline].mountpoint);
     641        mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint);
    642642        for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries;
    643643             i++) {
     
    651651        if (copies > 1 && last_copy == currline
    652652            && strcmp(curr_mountpoint, "raid")) {
    653             mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
     653            mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
    654654            mr_strcat(flaws_str, "%s", tmp);
    655655            log_it(tmp);
     
    690690    for (lino = 0, noof_drives = 0; lino < mountlist->entries; lino++) {
    691691
    692         mr_asprintf(&drive, "%s", mountlist->el[lino].device);
     692        mr_asprintf(drive, "%s", mountlist->el[lino].device);
    693693        if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    694694            log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive);
     
    777777                       (void *) &mountlist->el[i],
    778778                       sizeof(struct mountlist_line));
    779                 mr_asprintf(&tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
     779                mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
    780780                log_it(tmp);
    781781                paranoid_free(tmp);
     
    895895            if (j < items) {
    896896                strcat(mountlist->el[items].device, "_dup");
    897                 mr_asprintf(&tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
     897                mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    898898                log_it(tmp);
    899899                paranoid_free(tmp);
    900900            }
    901             mr_asprintf(&tmp, "%s", mountlist->el[items].device);
     901            mr_asprintf(tmp, "%s", mountlist->el[items].device);
    902902            if (strstr(tmp, "/dev/md/")) {
    903903                log_it("format_device() --- Contracting %s", tmp);
     
    10481048    assert(b >= 0);
    10491049
    1050     mr_asprintf(&device, "%s", mountlist->el[a].device);
    1051     mr_asprintf(&mountpoint, "%s", mountlist->el[a].mountpoint);
    1052     mr_asprintf(&format, "%s", mountlist->el[a].format);
     1050    mr_asprintf(device, "%s", mountlist->el[a].device);
     1051    mr_asprintf(mountpoint, "%s", mountlist->el[a].mountpoint);
     1052    mr_asprintf(format, "%s", mountlist->el[a].format);
    10531053
    10541054    size = mountlist->el[a].size;
  • branches/2.2.10/mondo/src/common/libmondo-raid.c

    r2321 r2323  
    5050    int res;
    5151
    52     mr_asprintf(&command, "grep \"");
     52    mr_asprintf(command, "grep \"");
    5353    if (raidno == -1) {
    5454        mr_strcat(command, "linear");
     
    197197    assert(label != NULL);
    198198
    199     mr_asprintf(&sz_value, "%d", value);
     199    mr_asprintf(sz_value, "%d", value);
    200200    strcpy(raidrec->additional_vars.el[lino].label, label);
    201201    strcpy(raidrec->additional_vars.el[lino].value, sz_value);
     
    585585    fclose(fin);
    586586    log_it("Raidtab loaded successfully.");
    587     mr_asprintf(&tmp1, "%d RAID devices in raidtab", raidlist->entries);
     587    mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries);
    588588    log_it(tmp1);
    589589    mr_free(tmp1);
     
    744744        }
    745745        if (!disklist) {
    746             mr_asprintf(&tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
     746            mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
    747747            log_it(tmp);
    748748            mr_free(tmp);
     
    10061006    pos = string;
    10071007    while (*pos == ' ') pos += 1;
    1008     mr_asprintf(&strtmp, "%s", pos);
     1008    mr_asprintf(strtmp, "%s", pos);
    10091009    strcpy(string, strtmp);
    10101010    paranoid_free(strtmp);
     
    10271027    token = mr_strtok(string, delims, &lastpos);
    10281028    // get RAID device name
    1029     mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1029    mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10301030    strcpy(raidlist->el[raidlist->entries].raid_device, strtmp);
    10311031    paranoid_free(strtmp);
     
    10861086      case ' ': // normal data disks
    10871087        raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1);
    1088         mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1088        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10891089        strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp);
    10901090        paranoid_free(strtmp);
     
    10931093      case 'S': // spare disks
    10941094        raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1);
    1095         mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1095        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10961096        strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp);
    10971097        paranoid_free(strtmp);
     
    11001100      case 'F': // failed disks
    11011101        raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1);
    1102         mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1102        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    11031103        strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp);
    11041104        paranoid_free(strtmp);
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2321 r2323  
    236236    int res;
    237237
    238     mr_asprintf(&command, "mt -f %s status", dev);
     238    mr_asprintf(command, "mt -f %s status", dev);
    239239    res = run_program_and_log_output(command, 1);
    240240    mr_free(command);
     
    268268        mr_asprintf(&cdr_exe, "dvdrecord");
    269269    }
    270     mr_asprintf(&command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe);
     270    mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe);
    271271    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    272272    mr_free(command);
     
    280280    mr_free(tmp);
    281281
    282     mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe);
     282    mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe);
    283283    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    284284    mr_free(command);
     
    290290    }
    291291    mr_free(tmp);
    292     mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);
     292    mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);
    293293    mr_free(cdr_exe);
    294294
     
    372372        }
    373373        if (strstr(fname, "xattr") == NULL) {
    374             mr_asprintf(&tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
     374            mr_asprintf(tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
    375375            fatal_error(tmp);
    376376        }
     
    402402        }
    403403        if (strstr(fname, "acl") == NULL) {
    404             mr_asprintf(&tmp,"Wrong order expected acl, got %s, sunshine.", fname);
     404            mr_asprintf(tmp,"Wrong order expected acl, got %s, sunshine.", fname);
    405405            fatal_error(tmp);
    406406        }
     
    468468    log_it("Insisting on tape #%d", tapeno);
    469469    if (g_current_media_number != tapeno) {
    470         mr_asprintf(&tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno);
     470        mr_asprintf(tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno);
    471471        popup_and_OK(tmp);
    472472        mr_free(tmp);
     
    544544        fatal_error("Unknown type. Internal error in maintain_collection_of_recent_archives()");
    545545    }
    546     mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir);
     546    mr_asprintf(tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir);
    547547    mkdir(tmpdir, 0x700);
    548     mr_asprintf(&command, "cp -f %s %s", latest_fname, tmpdir);
     548    mr_asprintf(command, "cp -f %s %s", latest_fname, tmpdir);
    549549    if (run_program_and_log_output(command, 6)) {
    550550        log_it("Warning - failed to copy %s to backcatalog at %s",
     
    575575
    576576    for (i = curr - 1; i >= 0 && curr - i < 10; i--) {
    577         mr_asprintf(&old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);
     577        mr_asprintf(old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);
    578578        unlink(old_fname);
    579579        mr_free(old_fname);
     
    615615        return (0);
    616616    }
    617     mr_asprintf(&tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);
     617    mr_asprintf(tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);
    618618    res = run_program_and_log_output(tmp, 3);
    619619    mr_free(tmp);
     
    684684
    685685    log_it("Skipping OBDR headers");
    686     mr_asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     686    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
    687687    res = run_program_and_log_output(command, 1);
    688688    paranoid_free(command);
    689689
    690     mr_asprintf(&command, "mt -f %s fsf 2",bkpinfo->media_device);
     690    mr_asprintf(command, "mt -f %s fsf 2",bkpinfo->media_device);
    691691    res = run_program_and_log_output(command, 1);
    692692    paranoid_free(command);
     
    711711    log_it("Creating OBDR headers");
    712712    /* OBDR: First block 10 kB of zero bs = 512 */
    713     mr_asprintf(&command, "mt -f %s compression off",bkpinfo->media_device);
     713    mr_asprintf(command, "mt -f %s compression off",bkpinfo->media_device);
    714714    res = run_program_and_log_output(command, 1);
    715715    paranoid_free(command);
    716716
    717     mr_asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     717    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
    718718    res += run_program_and_log_output(command, 1);
    719719    paranoid_free(command);
     
    721721    set_tape_block_size_with_mt(512);
    722722
    723     mr_asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
     723    mr_asprintf(command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
    724724    res += run_program_and_log_output(command, 1);
    725725    paranoid_free(command);
     
    728728    set_tape_block_size_with_mt(2048);
    729729
    730     mr_asprintf(&command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
     730    mr_asprintf(command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
    731731    res += run_program_and_log_output(command, 1);
    732732    paranoid_free(command);
     
    795795
    796796    insist_on_this_tape_number(1);
    797     mr_asprintf(&outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
     797    mr_asprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
    798798    make_hole_for_file(outfname);
    799799
     
    858858    (void) getcwd(old_cwd, MAX_STR_LEN);
    859859    chdir(bkpinfo->tmpdir);
    860     mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);
     860    mr_asprintf(tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);
    861861    paranoid_system(tmp);
    862862    mr_free(tmp);
     
    885885
    886886    /*  add 'dummy' if testing */
    887     mr_asprintf(&command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
     887    mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
    888888    /*  initialise the catalog */
    889889    g_current_media_number = 1;
     
    10581058    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    10591059    if (orig_size != temp_size && orig_size != -1) {
    1060         mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
     1060        mr_asprintf(tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
    10611061        log_to_screen(tmp);
    10621062        mr_free(tmp);
     
    11211121    log_msg(6, ".......................... Should be %lld", orig_size);
    11221122    g_tape_posK += total_read_from_tape_for_this_file / 1024;
    1123     mr_asprintf(&actual_cksum, "%04x%04x", crc16, crctt);
     1123    mr_asprintf(actual_cksum, "%04x%04x", crc16, crctt);
    11241124    if (foutstream) {           /*log_it("Finished writing to foutstream"); */
    11251125    } else {
     
    11311131    }
    11321132    if (strcmp(temp_cksum, actual_cksum)) {
    1133         mr_asprintf(&tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
     1133        mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
    11341134        log_to_screen(tmp);
    11351135        mr_free(tmp);
    11361136
    1137         mr_asprintf(&tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
     1137        mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    11381138        log_to_screen(tmp);
    11391139        mr_free(tmp);
     
    14861486    }
    14871487    if (bkpinfo->backup_media_type == cdstream) {
    1488         mr_asprintf(&command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE);
     1488        mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE);
    14891489        log_it("Opening OUT to next CD with the command");
    14901490        log_it(command);
     
    15381538    last = g_tapecatalog->entries - 1;
    15391539    for (i = 0; i <= last; i++) {
    1540         mr_asprintf(&fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);
     1540        mr_asprintf(fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);
    15411541        if (!does_file_exist(fname)) {
    15421542            log_msg(6, "Can't write %s - it doesn't exist.", fname);
     
    15911591    log_it("Data disks = %s", fname);
    15921592    if (!does_file_exist(fname)) {
    1593         mr_asprintf(&tmp, "Cannot find %s", fname);
     1593        mr_asprintf(tmp, "Cannot find %s", fname);
    15941594        log_to_screen(tmp);
    15951595        mr_free(tmp);
     
    16891689        p++;
    16901690    }
    1691     mr_asprintf(&tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
     1691    mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    16921692    log_it(tmp);
    16931693    mr_free(tmp);
     
    17311731    }
    17321732    paranoid_fclose(fin);
    1733     mr_asprintf(&checksum, "%04x%04x", crc16, crctt);
     1733    mr_asprintf(checksum, "%04x%04x", crc16, crctt);
    17341734    /* BERLIOS: what does it do ??? */
    17351735    write_header_block_to_stream((off_t)g_current_media_number, checksum, BLK_STOP_FILE);
     
    17941794        fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    17951795               g_tape_stream) / 1024;
    1796     mr_asprintf(&tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
     1796    mr_asprintf(tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
    17971797    log_msg(6, tmp);
    17981798    mr_free(tmp);
     
    18211821
    18221822    /*@ end vars *************************************************** */
    1823     mr_asprintf(&tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
     1823    mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    18241824    log_to_screen(tmp);
    18251825    mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2322 r2323  
    4545    assert(partno >= 0);
    4646
    47     mr_asprintf(&partition, drive);
     47    mr_asprintf(partition, drive);
    4848    /* is this a devfs device path? */
    4949    c = strrchr(partition, '/');
     
    241241        fatal_error("Integer overflow.");
    242242    } else if (ch != 'm' && ch != 'M') {
    243         mr_asprintf(&tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);
     243        mr_asprintf(tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);
    244244        fatal_error(tmp1);
    245245    }
     
    420420        p = ' ';
    421421    }
    422     mr_asprintf(&output, "%d %s disk%c", noof_disks, label, p);
     422    mr_asprintf(output, "%d %s disk%c", noof_disks, label, p);
    423423    while (strlen(output) < 14) {
    424424        mr_strcat(output, " ");
     
    511511            mr_strcat(output, "%s%s", q, value);
    512512        } else {
    513             mr_asprintf(&output, "%s%s", q, value);
     513            mr_asprintf(output, "%s%s", q, value);
    514514        }
    515515        p+= strlen(token);
     
    520520    } else {
    521521        /* just in case the token doesn't appear in string at all */
    522         mr_asprintf(&output, "%s", q);
     522        mr_asprintf(output, "%s", q);
    523523    }
    524524    return(output);
     
    555555    assert_string_is_neither_NULL_nor_zerolength(path);
    556556    if (s[0] != '\0') {
    557         mr_asprintf(&suffix, ".%s", s);
     557        mr_asprintf(suffix, ".%s", s);
    558558    } else {
    559         mr_asprintf(&suffix, "");
     559        mr_asprintf(suffix, "");
    560560    }
    561561    sprintf(output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno, sliceno, suffix);
     
    622622    if (strlen(flaws_str) > 0) {
    623623        paranoid_free(flaws_str_A);
    624         mr_asprintf(&flaws_str_A, "%s", flaws_str + 1);
     624        mr_asprintf(flaws_str_A, "%s", flaws_str + 1);
    625625    }
    626626    if (strlen(flaws_str_A) >= 74) {
    627627        for (i = 74; flaws_str_A[i] != ' '; i--);
    628628        paranoid_free(flaws_str_B);
    629         mr_asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1);
     629        mr_asprintf(flaws_str_B, "%s", flaws_str_A + i + 1);
    630630        flaws_str_A[i] = '\0';
    631631    }
     
    633633        for (i = 74; flaws_str_B[i] != ' '; i--);
    634634        paranoid_free(flaws_str_C);
    635         mr_asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1);
     635        mr_asprintf(flaws_str_C, "%s", flaws_str_B + i + 1);
    636636        flaws_str_B[i] = '\0';
    637637    }
     
    830830
    831831    assert_string_is_neither_NULL_nor_zerolength(partition);
    832     mr_asprintf(&trunc, "%s", partition);
     832    mr_asprintf(trunc, "%s", partition);
    833833
    834834#ifdef __FreeBSD__
     
    931931    assert_string_is_neither_NULL_nor_zerolength(fn);
    932932    if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) {
    933         mr_asprintf(&filename, "%s", fn + strlen(MNT_RESTORING));
     933        mr_asprintf(filename, "%s", fn + strlen(MNT_RESTORING));
    934934    } else if (fn[0] != '/') {
    935         mr_asprintf(&filename, "/%s", fn);
     935        mr_asprintf(filename, "/%s", fn);
    936936    } else {
    937         mr_asprintf(&filename, "%s", fn);
     937        mr_asprintf(filename, "%s", fn);
    938938    }
    939939
    940940    sev = 3;
    941     mr_asprintf(&reason, "Changed since backup. Consider running a differential backup in a day or two.");
     941    mr_asprintf(reason, "Changed since backup. Consider running a differential backup in a day or two.");
    942942
    943943    if (!strncmp(filename, "/var/", 5)) {
    944944        sev = 2;
    945945        mr_free(reason);
    946         mr_asprintf(&reason, "/var's contents will change regularly, inevitably.");
     946        mr_asprintf(reason, "/var's contents will change regularly, inevitably.");
    947947    }
    948948    if (!strncmp(filename, "/home", 5)) {
    949949        sev = 2;
    950950        mr_free(reason);
    951         mr_asprintf(&reason, "It's in your /home directory. Therefore, it is important.");
     951        mr_asprintf(reason, "It's in your /home directory. Therefore, it is important.");
    952952    }
    953953    if (!strncmp(filename, "/usr/", 5)) {
    954954        sev = 3;
    955955        mr_free(reason);
    956         mr_asprintf(&reason, "You may have installed/removed software during the backup.");
     956        mr_asprintf(reason, "You may have installed/removed software during the backup.");
    957957    }
    958958    if (!strncmp(filename, "/etc/", 5)) {
    959959        sev = 3;
    960960        mr_free(reason);
    961         mr_asprintf(&reason, "Do not edit config files while backing up your PC.");
     961        mr_asprintf(reason, "Do not edit config files while backing up your PC.");
    962962    }
    963963    if (!strcmp(filename, "/etc/adjtime")
     
    965965        sev = 1;
    966966        mr_free(reason);
    967         mr_asprintf(&reason, "This file changes all the time. It's OK.");
     967        mr_asprintf(reason, "This file changes all the time. It's OK.");
    968968    }
    969969    if (!strncmp(filename, "/root/", 6)) {
    970970        sev = 3;
    971971        mr_free(reason);
    972         mr_asprintf(&reason, "Were you compiling/editing something in /root?");
     972        mr_asprintf(reason, "Were you compiling/editing something in /root?");
    973973    }
    974974    if (!strncmp(filename, "/root/.", 7)) {
    975975        sev = 2;
    976976        mr_free(reason);
    977         mr_asprintf(&reason, "Temp or 'dot' files changed in /root.");
     977        mr_asprintf(reason, "Temp or 'dot' files changed in /root.");
    978978    }
    979979    if (!strncmp(filename, "/var/lib/", 9)) {
    980980        sev = 2;
    981981        mr_free(reason);
    982         mr_asprintf(&reason, "Did you add/remove software during backing?");
     982        mr_asprintf(reason, "Did you add/remove software during backing?");
    983983    }
    984984    if (!strncmp(filename, "/var/lib/rpm", 12)) {
    985985        sev = 3;
    986986        mr_free(reason);
    987         mr_asprintf(&reason, "Did you add/remove software during backing?");
     987        mr_asprintf(reason, "Did you add/remove software during backing?");
    988988    }
    989989    if (!strncmp(filename, "/var/lib/slocate", 16)) {
    990990        sev = 1;
    991991        mr_free(reason);
    992         mr_asprintf(&reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
     992        mr_asprintf(reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
    993993    }
    994994    if (!strncmp(filename, "/var/log/", 9)
     
    997997        sev = 1;
    998998        mr_free(reason);
    999         mr_asprintf(&reason, "Log files change frequently as the computer runs. Fret not.");
     999        mr_asprintf(reason, "Log files change frequently as the computer runs. Fret not.");
    10001000    }
    10011001    if (!strncmp(filename, "/var/spool", 10)) {
    10021002        sev = 1;
    10031003        mr_free(reason);
    1004         mr_asprintf(&reason, "Background processes or printers were active. This does not affect the integrity of your backup.");
     1004        mr_asprintf(reason, "Background processes or printers were active. This does not affect the integrity of your backup.");
    10051005    }
    10061006    if (!strncmp(filename, "/var/spool/mail", 10)) {
    10071007        sev = 2;
    10081008        mr_free(reason);
    1009         mr_asprintf(&reason, "Mail was sent/received during backup.");
     1009        mr_asprintf(reason, "Mail was sent/received during backup.");
    10101010    }
    10111011    if (filename[strlen(filename) - 1] == '~') {
    10121012        sev = 1;
    10131013        mr_free(reason);
    1014         mr_asprintf(&reason, "Backup copy of another file which was modified recently.");
     1014        mr_asprintf(reason, "Backup copy of another file which was modified recently.");
    10151015    }
    10161016    if (strstr(filename, "cache")) {
    10171017        sev = 1;
    10181018        mr_free(reason);
    1019         mr_asprintf(&reason, "Part of a cache of data. Caches change from time to time. Don't worry.");
     1019        mr_asprintf(reason, "Part of a cache of data. Caches change from time to time. Don't worry.");
    10201020    }
    10211021    if (!strncmp(filename, "/var/run/", 9)
     
    10251025        sev = 1;
    10261026        mr_free(reason);
    1027         mr_asprintf(&reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
     1027        mr_asprintf(reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
    10281028    }
    10291029    if (out_reason) {
     
    10881088
    10891089    if (bkpinfo->media_size[g_current_media_number] <= 0) {
    1090         mr_asprintf(&tmp, "%lld", g_tape_posK);
    1091         mr_asprintf(&pos_w_commas, "%s", commarize(tmp));
     1090        mr_asprintf(tmp, "%lld", g_tape_posK);
     1091        mr_asprintf(pos_w_commas, "%s", commarize(tmp));
    10921092        mr_free(tmp);
    1093         mr_asprintf(&outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);
     1093        mr_asprintf(outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);
    10941094        mr_free(pos_w_commas);
    10951095        return (outstr);
     
    11041104            percentage = 100;
    11051105        }
    1106         mr_asprintf(&outstr, "Volume %d: [", g_current_media_number);
     1106        mr_asprintf(outstr, "Volume %d: [", g_current_media_number);
    11071107    } else {
    11081108        percentage =
     
    11101110                   bkpinfo->media_size[g_current_media_number]);
    11111111        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1112         mr_asprintf(&outstr, "%s %d: [", mds, g_current_media_number);
     1112        mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number);
    11131113        mr_free(mds);
    11141114    }
     
    11361136    switch (type_of_bkp) {
    11371137    case dvd:
    1138         mr_asprintf(&type_of_backup, "DVD");
     1138        mr_asprintf(type_of_backup, "DVD");
    11391139        break;
    11401140    case cdr:
    1141         mr_asprintf(&type_of_backup, "CDR");
     1141        mr_asprintf(type_of_backup, "CDR");
    11421142        break;
    11431143    case cdrw:
    1144         mr_asprintf(&type_of_backup, "CDRW");
     1144        mr_asprintf(type_of_backup, "CDRW");
    11451145        break;
    11461146    case tape:
    1147         mr_asprintf(&type_of_backup, "tape");
     1147        mr_asprintf(type_of_backup, "tape");
    11481148        break;
    11491149    case cdstream:
    1150         mr_asprintf(&type_of_backup, "CDR");
     1150        mr_asprintf(type_of_backup, "CDR");
    11511151        break;
    11521152    case udev:
    1153         mr_asprintf(&type_of_backup, "udev");
     1153        mr_asprintf(type_of_backup, "udev");
    11541154        break;
    11551155    case iso:
    1156         mr_asprintf(&type_of_backup, "ISO");
     1156        mr_asprintf(type_of_backup, "ISO");
    11571157        break;
    11581158    case nfs:
    1159         mr_asprintf(&type_of_backup, "nfs");
     1159        mr_asprintf(type_of_backup, "nfs");
    11601160        break;
    11611161    case usb:
    1162         mr_asprintf(&type_of_backup, "USB");
     1162        mr_asprintf(type_of_backup, "USB");
    11631163        break;
    11641164    default:
    1165         mr_asprintf(&type_of_backup, "ISO");
     1165        mr_asprintf(type_of_backup, "ISO");
    11661166    }
    11671167    return (type_of_backup);
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2322 r2323  
    219219
    220220    uname(&utsn);
    221     mr_asprintf(&tmp, "%s", utsn.machine);
     221    mr_asprintf(tmp, "%s", utsn.machine);
    222222    return (tmp);
    223223}
     
    449449    if (bkpinfo->backup_media_type == tape) {
    450450        log_msg(1, "Bar");
    451         mr_asprintf(&tmp, "mt -f %s status", bkpinfo->media_device);
     451        mr_asprintf(tmp, "mt -f %s status", bkpinfo->media_device);
    452452        log_msg(1, "tmp = '%s'", tmp);
    453453        if (run_program_and_log_output(tmp, 3)) {
     
    501501        }
    502502        if (bkpinfo->nonbootable_backup) {
    503             mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
     503            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
    504504        } else if
    505505#ifdef __FreeBSD__
     
    510510#ifdef __IA64__
    511511    {
    512         mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);
     512        mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);
    513513    }
    514514#else
    515515    {
    516         mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);
     516        mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);
    517517    }
    518518#endif
    519519        else
    520520        {
    521             mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);
     521            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);
    522522        }
    523523        if (bkpinfo->manual_cd_tray) {
     
    533533        }
    534534        if (getenv ("SUDO_COMMAND")) {
    535             mr_asprintf(&command, "strings `which growisofs` | grep -c SUDO_COMMAND");
     535            mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND");
    536536            if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) {
    537537                mr_free(command);
     
    549549        || bkpinfo->backup_media_type == cdr) {
    550550        if (!bkpinfo->manual_cd_tray) {
    551             mr_asprintf(&extra_cdrom_params, "-waiti ");
     551            mr_asprintf(extra_cdrom_params, "-waiti ");
    552552        }
    553553        if (bkpinfo->backup_media_type == cdrw) {
    554             mr_asprintf(&extra_cdrom_params, "blank=fast ");
     554            mr_asprintf(extra_cdrom_params, "blank=fast ");
    555555        }
    556556        if (find_home_of_exe("cdrecord")) {
     
    562562        }
    563563        if (bkpinfo->nonbootable_backup) {
    564             mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);
     564            mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);
    565565        } else if
    566566#ifdef __FreeBSD__
     
    571571#ifdef __IA64__
    572572    {
    573         mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO);
     573        mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO);
    574574    }
    575575#else
    576576    {
    577         mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO);
     577        mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO);
    578578    }
    579579#endif
    580580        else
    581581        {
    582             mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);
     582            mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);
    583583        }
    584584        if (bkpinfo->manual_cd_tray) {
     
    621621
    622622        log_it("isodir = %s", bkpinfo->isodir);
    623         mr_asprintf(&command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir);
     623        mr_asprintf(command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir);
    624624        log_it("command = %s", command);
    625625        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    626         mr_asprintf(&iso_dev, "%s", call_program_and_get_last_line_of_output(command));
    627         mr_asprintf(&tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
     626        mr_asprintf(iso_dev, "%s", call_program_and_get_last_line_of_output(command));
     627        mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
    628628        write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));
    629629        mr_free(tmp);
    630630        mr_free(command);
    631631
    632         mr_asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);
     632        mr_asprintf(command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);
    633633        mr_free(iso_dev);
    634634
    635635        log_it("command = %s", command);
    636636        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    637         mr_asprintf(&iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
    638         mr_asprintf(&tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
     637        mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
     638        mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
    639639        write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));
    640640        mr_free(tmp);
     
    642642
    643643        log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt));
    644         mr_asprintf(&iso_tmp, "%s", bkpinfo->isodir);
     644        mr_asprintf(iso_tmp, "%s", bkpinfo->isodir);
    645645        if (strlen(iso_tmp) < strlen(iso_mnt)) {
    646             mr_asprintf(&iso_path, "%s", "");
     646            mr_asprintf(iso_path, "%s", "");
    647647        } else {
    648             mr_asprintf(&iso_path, "%s", iso_tmp + strlen(iso_mnt));
     648            mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt));
    649649        }
    650650        mr_free(iso_tmp);
    651651
    652         mr_asprintf(&tmp, "%s/ISODIR", bkpinfo->tmpdir);
     652        mr_asprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir);
    653653        write_one_liner_data_file(tmp, iso_path);
    654654        mr_free(tmp);
     
    657657        mr_free(iso_path);
    658658
    659         mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
     659        mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    660660        write_one_liner_data_file(tmp, bkpinfo->prefix);
    661661        mr_free(tmp);
     
    682682                retval++;
    683683            } else {
    684                 mr_asprintf(&ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
     684                mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    685685                mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':'));
    686686                strcpy(bkpinfo->nfs_mount, ip_address);
     
    696696    }
    697697    if (bkpinfo->include_paths == NULL) {
    698         mr_asprintf(&p, "/");
     698        mr_asprintf(p, "/");
    699699        bkpinfo->include_paths = p;
    700700    }
     
    732732
    733733    unlink(MONDO_TRACEFILE);
    734     mr_asprintf(&tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);
     734    mr_asprintf(tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);
    735735    run_program_and_log_output(tmp, FALSE);
    736736    paranoid_free(tmp);
     
    758758        /* purging a potential old tmpdir */
    759759        log_it("Purging old tmpdir %s", bkpinfo->tmpdir);
    760         mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir);
     760        mr_asprintf(tmp,"rm -Rf %s",bkpinfo->tmpdir);
    761761        mr_free(bkpinfo->tmpdir);
    762762        (void)system(tmp);
     
    765765
    766766    if (path != NULL) {
    767         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path);
     767        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", path);
    768768    } else if (getenv("TMPDIR")) {
    769         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));
     769        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));
    770770    } else if (getenv("TMP")) {
    771         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP"));
     771        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP"));
    772772    } else {
    773         mr_asprintf(&tmp, "/tmp/mondo.tmp.XXXXXX");
     773        mr_asprintf(tmp, "/tmp/mondo.tmp.XXXXXX");
    774774    }
    775775    p = mkdtemp(tmp);
     
    821821    bkpinfo->use_lzo = FALSE;
    822822    bkpinfo->use_gzip = FALSE;
    823     bkpinfo->do_not_compress_these[0] = '\0';
    824823    bkpinfo->verify_data = FALSE;
    825824    bkpinfo->backup_data = FALSE;
     
    829828    bkpinfo->disaster_recovery = (am_I_in_disaster_recovery_mode()? TRUE : FALSE);
    830829    if (bkpinfo->disaster_recovery) {
    831         strcpy(bkpinfo->isodir, "/");
     830        mr_asprintf(p, "%s", "/");
    832831    } else {
    833         strcpy(bkpinfo->isodir, MONDO_CACHE);
    834     }
    835     mr_asprintf(&p, "%s", STD_PREFIX);
     832        mr_asprintf(p, "%s", MONDO_CACHE);
     833    }
     834    bkpinfo->isodir = p;
     835    mr_asprintf(p, "%s", STD_PREFIX);
    836836    bkpinfo->prefix = p;
    837837    bkpinfo->scratchdir = NULL;
     
    882882    assert_string_is_neither_NULL_nor_zerolength(partition);
    883883
    884     mr_asprintf(&command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);
     884    mr_asprintf(command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);
    885885    if (system(command)) {
    886886        mr_free(command);
     
    889889    mr_free(command);
    890890
    891     mr_asprintf(&command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
     891    mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
    892892            partition);
    893     mr_asprintf(&out_sz, "%s", call_program_and_get_last_line_of_output(command));
     893    mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command));
    894894    mr_free(command);
    895895
     
    935935            ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
    936936    }
    937     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     937    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
    938938    if (atol(tmp) < 35000) {
    939939        retval++;
     
    10061006    run_program_and_log_output
    10071007        ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    1008     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));
     1008    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));
    10091009    if (strcmp("", tmp)) {
    10101010        if (strstr(tmp, "autofs")) {
     
    10391039        fatal_error("Please reinstall Mondo and Mindi.");
    10401040    }
    1041     mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);
     1041    mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);
    10421042    if (run_program_and_log_output(tmp, 5)) {
    10431043        mr_free(tmp);
    1044         mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);
     1044        mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);
    10451045        log_to_screen(tmp);
    10461046        log_to_screen
     
    10871087    assert_string_is_neither_NULL_nor_zerolength(label);
    10881088    if (!does_file_exist(config_file)) {
    1089         mr_asprintf(&tmp, "(read_cfg_var) Cannot find %s config file", config_file);
     1089        mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file", config_file);
    10901090        log_to_screen(tmp);
    10911091        mr_free(tmp);
     
    10971097        return (0);
    10981098    } else {
    1099         mr_asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
     1099        mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
    11001100        strcpy(value, call_program_and_get_last_line_of_output(command));
    11011101        mr_free(command);
     
    11801180        log_msg(3, "%s --- autofs detected", g_autofs_exe);
    11811181        // FIXME -- only disable it if it's running ---  sprintf(tmp, "%s status", autofs_exe);
    1182         mr_asprintf(&tmp, "%s stop", g_autofs_exe);
     1182        mr_asprintf(tmp, "%s stop", g_autofs_exe);
    11831183        if (run_program_and_log_output(tmp, 2)) {
    11841184            log_it("Failed to stop autofs - I assume it wasn't running");
     
    12021202        return;
    12031203    }
    1204     mr_asprintf(&tmp, "%s start", g_autofs_exe);
     1204    mr_asprintf(tmp, "%s start", g_autofs_exe);
    12051205    if (run_program_and_log_output(tmp, 2)) {
    12061206        log_it("Failed to start autofs");
     
    12251225    g_boot_mountpt[0] = '\0';
    12261226    log_msg(4, "Done. Great. Seeting command to something");
    1227     mr_asprintf(&command, "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[    ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
     1227    mr_asprintf(command, "%s", "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[   ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
    12281228    log_msg(4, "Cool. Command = '%s'", command);
    1229     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1229    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    12301230    mr_free(command);
    12311231
     
    12331233    if (tmp[0]) {
    12341234        log_it("/boot is at %s according to /etc/fstab", tmp);
    1235         mr_asprintf(&command, "mount | grep -Ew '/boot'");
     1235        mr_asprintf(command, "mount | grep -Ew '/boot'");
    12361236        mr_free(tmp);
    1237         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1237        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    12381238        mr_free(command);
    12391239
     
    12471247                }
    12481248            } else {
    1249                 mr_asprintf(&command, "mount | grep -E '^%s'", tmp);
     1249                mr_asprintf(command, "mount | grep -E '^%s'", tmp);
    12501250                log_msg(3, "command = %s", command);
    12511251                if (run_program_and_log_output(command, 5)) {
    12521252                    strcpy(g_boot_mountpt, tmp);
    12531253                    mr_free(tmp);
    1254                     mr_asprintf(&tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
     1254                    mr_asprintf(tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
    12551255                    log_it(tmp);
    12561256                    mr_free(tmp);
    12571257
    1258                     mr_asprintf(&tmp, "mount %s", g_boot_mountpt);
     1258                    mr_asprintf(tmp, "mount %s", g_boot_mountpt);
    12591259                    if (run_program_and_log_output(tmp, 5)) {
    12601260                        g_boot_mountpt[0] = '\0';
     
    12871287    log_msg(3, "starting");
    12881288    if (g_boot_mountpt[0]) {
    1289         mr_asprintf(&tmp, "umount %s", g_boot_mountpt);
     1289        mr_asprintf(tmp, "umount %s", g_boot_mountpt);
    12901290        if (run_program_and_log_output(tmp, 5)) {
    12911291            log_it("WARNING - unable to unmount /boot");
     
    13191319    assert(value != NULL);
    13201320    if (!does_file_exist(config_file)) {
    1321         mr_asprintf(&tmp, "(write_cfg_file) Cannot find %s config file", config_file);
     1321        mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file", config_file);
    13221322        log_to_screen(tmp);
    13231323        mr_free(tmp);
    13241324        return (1);
    13251325    }
    1326     mr_asprintf(&tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
     1326    mr_asprintf(tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
    13271327    if (does_file_exist(config_file)) {
    1328         mr_asprintf(&command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile);
     1328        mr_asprintf(command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile);
    13291329        paranoid_system(command);
    13301330        mr_free(command);
    13311331    }
    1332     mr_asprintf(&command, "echo \"%s %s\" >> %s", label, value, tempfile);
     1332    mr_asprintf(command, "echo \"%s %s\" >> %s", label, value, tempfile);
    13331333    paranoid_system(command);
    13341334    mr_free(command);
    13351335
    1336     mr_asprintf(&command, "mv -f %s %s", tempfile, config_file);
     1336    mr_asprintf(command, "mv -f %s %s", tempfile, config_file);
    13371337    paranoid_system(command);
    13381338    mr_free(command);
     
    14631463
    14641464    if (g_magicdev_command && g_magicdev_command[0]) {
    1465         mr_asprintf(&tmp, "%s &", g_magicdev_command);
     1465        mr_asprintf(tmp, "%s &", g_magicdev_command);
    14661466        paranoid_system(tmp);
    14671467        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2321 r2323  
    9393    assert_string_is_neither_NULL_nor_zerolength(stderr_fname);
    9494
    95     mr_asprintf(&afio_found_changes, "%s.afio", ignorefiles_fname);
     95    mr_asprintf(afio_found_changes, "%s.afio", ignorefiles_fname);
    9696    paranoid_system("sync");
    9797
    9898    log_msg(1, "Now scanning log file for 'afio: ' stuff");
    99     mr_asprintf(&command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
     99    mr_asprintf(command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
    100100    log_msg(2, command);
    101101    res = system(command);
     
    107107
    108108    log_msg(1, "Now scanning log file for 'star: ' stuff");
    109     mr_asprintf(&command, "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
     109    mr_asprintf(command, "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
    110110    log_msg(2, command);
    111111    res = system(command);
     
    116116    }
    117117    afio_diffs = count_lines_in_file(afio_found_changes);
    118     mr_asprintf(&command, "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", ignorefiles_fname, afio_found_changes, afio_found_changes, changedfiles_fname);
     118    mr_asprintf(command, "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", ignorefiles_fname, afio_found_changes, afio_found_changes, changedfiles_fname);
    119119    mr_free(afio_found_changes);
    120120    log_msg(2, command);
     
    167167        } else {
    168168            retval++;
    169             mr_asprintf(&tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1);
     169            mr_asprintf(tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1);
    170170            log_to_screen(tmp);
    171171            mr_free(tmp);
     
    173173    }
    174174    mds = media_descriptor_string(bkpinfo->backup_media_type);
    175     mr_asprintf(&tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);
     175    mr_asprintf(tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);
    176176    mr_free(mds);
    177177
     
    269269    log_it("before vsbf");
    270270    mds = media_descriptor_string(bkpinfo->backup_media_type);
    271     mr_asprintf(&tmp, "Verifying %s#%d's big files", mds, g_current_media_number);
     271    mr_asprintf(tmp, "Verifying %s#%d's big files", mds, g_current_media_number);
    272272    mr_free(mds);
    273273
     
    276276
    277277    log_it("after vsbf");
    278     mr_asprintf(&mountpoint, "%s/archives", mtpt);
     278    mr_asprintf(mountpoint, "%s/archives", mtpt);
    279279    if (last_bigfile_num == -1) {
    280280        bigfile_num = 0;
     
    302302                paranoid_fclose(fin);
    303303            }
    304             mr_asprintf(&tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
     304            mr_asprintf(tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
    305305            log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp);
    306306            forig = fopen(tmp, "r");
     
    312312                            bkpinfo->restore_path,
    313313                            biggiestruct.filename);
    314                 mr_asprintf(&tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir);
     314                mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir);
    315315                system(tmp);
    316316                mr_free(tmp);
     
    333333                    g_current_media_number, bigfile_num, slice_num);
    334334            if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) {
    335                 mr_asprintf(&command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE);
     335                mr_asprintf(command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE);
    336336            } else {
    337                 mr_asprintf(&command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE);
     337                mr_asprintf(command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE)