Changeset 2324


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

r3335@localhost: bruno | 2009-08-08 23:04:12 +0200

  • Change mr_asprintf to avoid the need of pointer and be consistent with the other mr_mem functions
Location:
branches/2.2.10/mondo/src
Files:
18 edited

Legend:

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

    r2323 r2324  
    202202
    203203    if (!does_file_exist(filelist)) {
    204         mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
    205         log_to_screen(tmp);
    206         paranoid_free(tmp);
     204        log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist);
    207205        return (1);
    208206    }
     
    210208    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    211209    if (system(tmp)) {
    212         paranoid_free(tmp);
     210        mr_free(tmp);
    213211        fatal_error("Unable to write tarball to scratchdir");
    214212    }
    215213    paranoid_free(tmp);
    216214
    217     mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s",
    218             filelist, fname);
     215    mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s", filelist, fname);
    219216    if (bkpinfo->use_lzo) {
     217        mr_free(command);
    220218        fatal_error("Can't use lzop");
    221219    }
     
    237235            res = 0;
    238236        }
    239         paranoid_free(tmp);
     237        mr_free(tmp);
    240238
    241239        if (res) {
     
    253251        }
    254252    }
    255     paranoid_free(command);
     253    mr_free(command);
    256254
    257255    retval += res;
     
    309307
    310308    if (!does_file_exist(filelist)) {
    311         mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist",
    312                 filelist);
    313         log_to_screen(tmp);
    314         paranoid_free(tmp);
     309        log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist);
    315310        return (1);
    316311    }
    317312    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    318313    if (system(tmp)) {
    319         paranoid_free(tmp);
     314        mr_free(tmp);
    320315        fatal_error("Unable to write tarball to scratchdir");
    321316    }
    322     paranoid_free(tmp);
     317    mr_free(tmp);
    323318
    324319
     
    326321        mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    327322        //       -b %ld, TAPE_BLOCK_SIZE
    328         mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
    329                 bkpinfo->compression_level);
     323        mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, bkpinfo->compression_level);
    330324        if (does_file_exist(tmp)) {
    331325            mr_strcat(zipparams, " -E %s",tmp);
     
    333327            log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp);
    334328        }
    335         paranoid_free(tmp);
     329        mr_free(tmp);
    336330    } else {
    337331        mr_asprintf(zipparams, "");
     
    346340        fatal_error("scratchdir not found");
    347341    }
    348     mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,
    349             fname, bkpinfo->zip_suffix);
     342    mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, fname, bkpinfo->zip_suffix);
    350343    paranoid_system(command);
    351     paranoid_free(command);
     344    mr_free(command);
    352345
    353346    mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
    354     paranoid_free(zipparams);
     347    mr_free(zipparams);
    355348
    356349    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    357350    if (system(tmp)) {
    358         paranoid_free(tmp);
     351        mr_free(tmp);
    359352        fatal_error("Unable to write tarball to scratchdir");
    360353    }
    361     paranoid_free(tmp);
     354    mr_free(tmp);
    362355
    363356    for (res = 99, tries = 0; tries < 3 && res != 0; tries++) {
     
    545538        mr_free(tmp);
    546539
    547         mr_asprintf(tmp, "devs_to_exclude = '%s'", devs_to_exclude);
    548         log_msg(2, tmp);
    549         mr_free(tmp);
     540        log_msg(2, "devs_to_exclude = '%s'", devs_to_exclude);
    550541    }
    551542
     
    557548        mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    558549        if (!does_file_exist(tmp)) {
    559             fatal_error
    560                 ("Cannot find filelist.full, so I cannot count its lines");
     550            mr_free(tmp);
     551            fatal_error ("Cannot find filelist.full, so I cannot count its lines");
    561552        }
    562553    }
     
    623614
    624615#ifdef __FreeBSD__
    625         mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    626                ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     616        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    627617        if (!bootdev[0]) {
    628618            mr_free(bootdev);
    629             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    630                    ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     619            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    631620        }
    632621#else
    633622        /* Linux */
    634623#ifdef __IA64__
    635         mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    636                ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     624        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    637625#else
    638         mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    639                ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     626        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    640627#endif
    641628        if (strstr(bootdev, "/dev/cciss/")) {
    642629            mr_free(bootdev);
    643630#ifdef __IA64__
    644             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    645                    ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     631            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    646632#else
    647             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    648                    ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     633            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    649634#endif
    650635        }
    651636        if (!bootdev[0]) {
    652637            mr_free(bootdev);
    653             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    654                    ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     638            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    655639            if (strstr(bootdev, "/dev/cciss/")) {
    656640                mr_free(bootdev);
    657                 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    658                        ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     641                mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    659642            }
    660643        }
     
    666649            ch = 'U';
    667650        if (bkpinfo->boot_loader != '\0') {
    668             mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
    669             log_msg(2, tmp);
    670             mr_free(tmp);
     651            log_msg(2, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
    671652        } else {
    672653            bkpinfo->boot_loader = ch;
    673654        }
    674655        if (bkpinfo->boot_device[0] != '\0') {
    675             mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
    676             log_msg(2, tmp);
    677             mr_free(tmp);
     656            log_msg(2, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
    678657        } else {
    679658            strcpy(bkpinfo->boot_device, bootdev);
     
    698677        mr_asprintf(bootldr_str, "LILO");
    699678        if (!does_file_exist("/etc/lilo.conf")) {
    700             fatal_error
    701                 ("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?");
     679            fatal_error("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?");
    702680        }
    703681    } else if (bkpinfo->boot_loader == 'G') {
    704682        mr_asprintf(bootldr_str, "GRUB");
    705         if (!does_file_exist("/boot/grub/menu.lst")
    706             && does_file_exist("/boot/grub/grub.conf")) {
    707             run_program_and_log_output
    708                 ("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5);
     683        if (!does_file_exist("/boot/grub/menu.lst") && does_file_exist("/boot/grub/grub.conf")) {
     684            run_program_and_log_output("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5);
    709685        }
    710686        if (!does_file_exist("/boot/grub/menu.lst")) {
    711             fatal_error
    712                 ("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst but I cannot find it there. What is wrong with your Linux distribution?");
     687            fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst but I cannot find it there. What is wrong with your Linux distribution?");
    713688        }
    714689    } else if (bkpinfo->boot_loader == 'E') {
    715690        mr_asprintf(bootldr_str, "ELILO");
    716691        /* BCO: fix it for Debian, Mandrake, ... */
    717         if (!does_file_exist("/etc/elilo.conf")
    718             && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) {
    719             run_program_and_log_output
    720                 ("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf",
    721                  5);
    722         }
    723         if (!does_file_exist("/etc/elilo.conf")
    724             && does_file_exist("/boot/efi/efi/SuSE/elilo.conf")) {
    725             run_program_and_log_output
    726                 ("ln -sf /boot/efi/efi/SuSE/elilo.conf /etc/elilo.conf",
    727                  5);
    728         }
    729         if (!does_file_exist("/etc/elilo.conf")
    730             && does_file_exist("/boot/efi/efi/debian/elilo.conf")) {
    731             run_program_and_log_output
    732                 ("ln -sf /boot/efi/efi/debian/elilo.conf /etc/elilo.conf",
    733                  5);
    734         }
    735         if (!does_file_exist("/etc/elilo.conf")
    736             && does_file_exist("/boot/efi/debian/elilo.conf")) {
    737             run_program_and_log_output
    738                 ("ln -sf /boot/efi/debian/elilo.conf /etc/elilo.conf",
    739                  5);
     692        if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) {
     693            run_program_and_log_output("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 5);
     694        }
     695        if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/SuSE/elilo.conf")) {
     696            run_program_and_log_output("ln -sf /boot/efi/efi/SuSE/elilo.conf /etc/elilo.conf", 5);
     697        }
     698        if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/debian/elilo.conf")) {
     699            run_program_and_log_output ("ln -sf /boot/efi/efi/debian/elilo.conf /etc/elilo.conf", 5);
     700        }
     701        if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/debian/elilo.conf")) {
     702            run_program_and_log_output ("ln -sf /boot/efi/debian/elilo.conf /etc/elilo.conf", 5);
    740703        }
    741704        if (!does_file_exist("/etc/elilo.conf")) {
    742             fatal_error
    743                 ("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'");
     705            fatal_error("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'");
    744706        }
    745707    } else if (bkpinfo->boot_loader == 'R') {
     
    758720        mr_asprintf(bootldr_str, "unknown");
    759721    }
    760     mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    761     log_to_screen(tmp);
    762     mr_free(tmp);
     722    log_to_screen("Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    763723
    764724    mr_asprintf(tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
     
    808768    if (write_one_liner_data_file(tmp, value)) {
    809769        res++;
    810         log_msg(1, "%ld: Unable to write one-liner backup-media-type",
    811                 __LINE__);
     770        log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__);
    812771    }
    813772    mr_free(value);
     
    817776    if (write_one_liner_data_file(tmp, bootldr_str)) {
    818777        res++;
    819         log_msg(1, "%ld: Unable to write one-liner bootloader.name",
    820                 __LINE__);
     778        log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__);
    821779    }
    822780    mr_free(bootldr_str);
     
    837795                __LINE__);
    838796        }
    839         paranoid_free(tmp1);
     797        mr_free(tmp1);
    840798    }
    841799    if (g_getfacl) {
    842800        mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir);
    843801        if (write_one_liner_data_file(tmp1, "TRUE")) {
    844             log_msg(1, "%ld: Unable to write one-liner ACL",
    845                 __LINE__);
    846         }
    847         paranoid_free(tmp1);
     802            log_msg(1, "%ld: Unable to write one-liner ACL", __LINE__);
     803        }
     804        mr_free(tmp1);
    848805    }
    849806    if (bkpinfo->use_obdr) {
    850807        mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir);
    851808        if (write_one_liner_data_file(tmp1, "TRUE")) {
    852             log_msg(1, "%ld: Unable to write one-liner OBDR",
    853                 __LINE__);
    854         }
    855         paranoid_free(tmp1);
     809            log_msg(1, "%ld: Unable to write one-liner OBDR", __LINE__);
     810        }
     811        mr_free(tmp1);
    856812    }
    857813
    858814    estimated_total_noof_slices =
    859815        size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    860     /* add nfs stuff here? */
     816    /* BERLIOS: add nfs stuff here? */
    861817    mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir);
    862818    if (system(command)) {
     
    867823    log_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
    868824
    869     mr_asprintf(command,
    870825/*     "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \
    8718266=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \
    87282711=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
    873     mr_asprintf(&command, "mindi %s --custom %s %s/images '%s' '%s' \
    874 '%s' %ld '%s' '%s' '%s' \
     828    mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' '%s' %ld '%s' '%s' '%s' \
    875829'%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir,    // parameter #2
    876830            bkpinfo->scratchdir,    // parameter #3
     
    923877        log_msg(2, command);
    924878        run_program_and_log_output(command, FALSE);
    925         paranoid_free(command);
     879        mr_free(command);
    926880
    927881        if (bkpinfo->nonbootable_backup) {
    928882            mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
    929883            if (system(command)) {
    930                 paranoid_free(command);
     884                mr_free(command);
    931885                fatal_error("Unable to create temporary all tarball");
    932886            }
    933             paranoid_free(command);
     887            mr_free(command);
    934888        }
    935889        /* For USB we already have everything on the key */
     
    937891            mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir);
    938892            run_program_and_log_output(command, FALSE);
    939             paranoid_free(command);
     893            mr_free(command);
    940894        } else {
    941895            mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
    942896            if (system(tmp)) {
     897                mr_free(tmp);
    943898                fatal_error("Cannot find all.tar.gz in tmpdir");
    944899            }
     
    954909        mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log");
    955910        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    956         paranoid_free(command);
     911        mr_free(command);
    957912
    958913        if (strlen(tmp) > 1) {
     
    10921047
    10931048        if (res) {
    1094             mr_asprintf(tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
    1095             log_to_screen(tmp);
    1096             mr_free(tmp);
     1049            log_to_screen("Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
    10971050        }
    10981051        if (!semaphore_p()) {
     
    14701423                mr_free(media_usage_comment);
    14711424                if (res) {
    1472                     mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no);
    1473                     log_to_screen(tmp);
    1474                     paranoid_free(tmp);
    1475                     fatal_error
    1476                         ("Is your hard disk full? If not, please send the author the logfile.");
     1425                    log_to_screen("Failed to add archive %ld's files to CD dir\n", storing_set_no);
     1426                    fatal_error("Is your hard disk full? If not, please send the author the logfile.");
    14771427                }
    14781428                storing_set_no++;
     
    15041454    }
    15051455    log_to_screen(tmp);
    1506     paranoid_free(tmp);
     1456    mr_free(tmp);
    15071457
    15081458    paranoid_free(transfer_block);
     
    15581508    mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir);
    15591509    run_program_and_log_output(tmp, FALSE);
    1560     paranoid_free(tmp);
     1510    mr_free(tmp);
    15611511    (void)chdir(bkpinfo->scratchdir);
    15621512
     
    15711521        mr_asprintf(tmp, "umount %s", tmp1);
    15721522        run_program_and_log_output(tmp, FALSE);
    1573         paranoid_free(tmp);
    1574     }
    1575     paranoid_free(tmp);
     1523        mr_free(tmp);
     1524    }
     1525    mr_free(tmp1);
    15761526
    15771527    log_msg(1, "Mounting USB device.");
     
    15791529    mr_asprintf(tmp, "mkdir -p %s", tmp1);
    15801530    run_program_and_log_output(tmp, FALSE);
    1581     paranoid_free(tmp);
     1531    mr_free(tmp);
     1532
    15821533    /* Mindi always create one single parition on the USB dev */
    15831534    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
    15841535    run_program_and_log_output(tmp, FALSE);
    1585     paranoid_free(tmp);
     1536    mr_free(tmp);
    15861537
    15871538    if (bkpinfo->nonbootable_backup) {
     
    15991550        }
    16001551        log_to_screen(result_sz);
    1601         paranoid_free(result_sz);
    1602         paranoid_free(tmp);
     1552        mr_free(result_sz);
     1553        mr_free(tmp);
    16031554        retval += res;
    16041555
     
    16061557        mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
    16071558        run_program_and_log_output(tmp, FALSE);
    1608         paranoid_free(tmp);
     1559        mr_free(tmp);
    16091560    }
    16101561    paranoid_free(message_to_screen);
     
    16141565        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    16151566        run_program_and_log_output(tmp, FALSE);
    1616         paranoid_free(tmp);
     1567        mr_free(tmp);
    16171568    }
    16181569
     
    16951646    if (bkpinfo->call_before_iso[0] != '\0') {
    16961647        mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
    1697         res =
    1698             eval_call_to_make_ISO(bkpinfo->call_before_iso,
    1699                                   destfile, g_current_media_number,
    1700                                   MONDO_LOGFILE, message_to_screen);
     1648        res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
    17011649        if (res) {
    17021650            mr_strcat(message_to_screen, "...failed");
     
    20151963    log_to_screen(tmp);
    20161964    noof_biggie_files = count_lines_in_file(biggielist_fname);
    2017     open_progress_form("Backing up big files", tmp,
    2018                        "Please wait. This may take some time.", "",
    2019                        estimated_total_noof_slices);
    2020     paranoid_free(tmp);
     1965    open_progress_form("Backing up big files", tmp, "Please wait. This may take some time.", "", estimated_total_noof_slices);
     1966    mr_free(tmp);
    20211967
    20221968    if (!(fin = fopen(biggielist_fname, "r"))) {
     
    21272073        }
    21282074#endif
    2129         paranoid_free(tmp);
     2075        mr_free(tmp);
    21302076    }
    21312077    log_msg(1, "Finished backing up bigfiles");
     
    21952141        retval += res;
    21962142        if (res) {
    2197             mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    2198             log_to_screen(tmp);
    2199             mr_free(tmp);
     2143            log_to_screen("Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    22002144        }
    22012145
     
    22472191
    22482192        if (res) {
    2249             mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
    2250             log_to_screen(tmp);
    2251             mr_free(tmp);
    2252             fatal_error
    2253                 ("Is your hard disk is full? If not, please send the author the logfile.");
     2193            log_to_screen("Failed to add archive %ld's files to CD dir\n", curr_set_no);
     2194            fatal_error("Is your hard disk is full? If not, please send the author the logfile.");
    22542195        }
    22552196        mr_free(curr_filelist_fname);
     
    26822623
    26832624    mds = media_descriptor_string(g_backup_media_type);
    2684     mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number);
     2625    log_to_screen("I am about to burn %s #%d", mds, g_current_media_number);
    26852626    mr_free(mds);
    2686     log_to_screen(tmp);
    2687     mr_free(tmp);
    26882627    if (g_current_media_number < ask_for_one_if_more_than_this) {
    26892628        return;
     
    29932932    if (!(fin = fopen(file_to_openin, "r"))) {
    29942933        log_OS_error("Unable to openin biggie_filename");
    2995         mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
    2996         log_to_screen(tmp);
    2997         paranoid_free(tmp);
     2934        log_to_screen("Cannot archive bigfile '%s': not found", biggie_filename);
    29982935
    29992936        paranoid_free(checksum_line);
     
    31153052        retval += res;
    31163053        if (res) {
    3117             mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    3118             log_to_screen(tmp);
    3119             paranoid_free(tmp);
    3120             fatal_error
    3121                 ("Hard disk full. You should have bought a bigger one.");
     3054            log_to_screen("Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
     3055            fatal_error("Hard disk full. You should have bought a bigger one.");
    31223056        }
    31233057    }
     
    31323066    }
    31333067    log_msg(1, tmp);
    3134     paranoid_free(tmp);
     3068    mr_free(tmp);
    31353069
    31363070    paranoid_free(checksum_line);
     
    33103244    if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 >
    33113245        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]);
    3313         log_to_screen(tmp1);
    3314         mr_free(tmp1);
     3246        log_to_screen("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]);
    33153247    }
    33163248    mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     
    33773309    mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);
    33783310    if (system(tmp1)) {
    3379         log_msg
    3380             (2,
    3381              "Error occurred when I tried to delete the redundant IMGs and GZs");
     3311        log_msg(2, "Error occurred when I tried to delete the redundant IMGs and GZs");
    33823312    }
    33833313    mr_free(tmp1);
     
    34553385            if (res) {
    34563386                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);
     3387                log_to_screen("Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    34583388                mr_free(mds);
    3459                 log_to_screen(tmp);
    3460                 mr_free(tmp);
    34613389
    34623390            }
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2323 r2324  
    111111    for (i = 0; i < 128; i++) {
    112112        if (flag_set[i]) {
    113             mr_asprintf(tmp, "-%c %s", i, flag_val[i]);
    114             log_msg(3, tmp);
    115             mr_free(tmp);
     113            log_msg(3, "-%c %s", i, flag_val[i]);
    116114        }
    117115    }
     
    150148    int j;
    151149    char tmp[MAX_STR_LEN], *p;
    152     char *comment = NULL;
    153150
    154151    assert(bkpinfo != NULL);
     
    161158        *(strchr(tmp, ',')) = '\0';
    162159        bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(tmp);
    163         mr_asprintf(comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);
    164         log_msg(3, comment);
    165         mr_free(comment);
     160        log_msg(3, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);
    166161    }
    167162    for (; j <= MAX_NOOF_MEDIA; j++) {
     
    837832        }
    838833        bkpinfo->make_filelist = FALSE;
    839         mr_asprintf(p, "%s", flag_val['J']);
    840         mr_free(bkpinfo->include_paths);
    841         bkpinfo->include_paths = p;
     834        mr_asprintf(bkpinfo->include_paths, "%s", flag_val['J']);
    842835    }
    843836
     
    878871            log_msg(3, "flag_val['c'] = %s", flag_val['c']);
    879872            log_msg(3, "flag_val['w'] = %s", flag_val['w']);
    880 //    log_msg(3, "flag_set['r'] = %i", flag_set['r'] );
     873            // log_msg(3, "flag_set['r'] = %i", flag_set['r'] );
    881874            if (flag_set['c']) {
    882875                bkpinfo->cdrw_speed = atoi(flag_val['c']);
     
    902895        flag_set['d'] = TRUE;
    903896        strcpy(flag_val['d'], p);
    904         mr_free(p);
    905         mr_asprintf(tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
    906         log_to_screen(tmp1);
    907         mr_free(tmp1);
     897        log_to_screen("You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
    908898        percent = 0;
    909899    }
     
    1004994            p--;
    1005995            *p = '\0';
    1006             mr_asprintf(q,"%s",bkpinfo->nfs_mount);
    1007             bkpinfo->nfs_user = q;
     996            mr_asprintf(bkpinfo->nfs_user,"%s",p);
    1008997            strcpy(bkpinfo->nfs_mount,tmp);
    1009998        }
    1010999        mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
    10111000        mr_free(bkpinfo->isodir);
    1012         mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    1013         bkpinfo->isodir = tmp2;
     1001        mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));
    10141002        mr_free(tmp1);
    10151003
     
    10251013                mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
    10261014                mr_free(bkpinfo->isodir);
    1027                 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    1028                 bkpinfo->isodir = tmp2;
     1015                mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));
    10291016                mr_free(tmp1);
    10301017
     
    12131200            && !does_file_exist(bkpinfo->kernel_path)) {
    12141201            retval++;
    1215             mr_asprintf(tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
    1216             log_to_screen(tmp1);
    1217             mr_free(tmp1);
     1202            log_to_screen("You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
    12181203        }
    12191204    }
     
    12211206    if (flag_set['p']) {
    12221207        mr_free(bkpinfo->prefix);
    1223         mr_asprintf(tmp1, "%s", flag_val['p']);
    1224         bkpinfo->prefix = tmp1;
     1208        mr_asprintf(bkpinfo->prefix, "%s", flag_val['p']);
    12251209        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    12261210    }
     
    12291213        if (flag_set['i']) {
    12301214            mr_free(bkpinfo->isodir);
    1231             mr_asprintf(tmp2, "%s", flag_val['d']);
    1232             bkpinfo->isodir = tmp2;
     1215            mr_asprintf(bkpinfo->isodir, "%s", flag_val['d']);
    12331216            mr_asprintf(tmp1, "ls -l %s", bkpinfo->isodir);
    12341217            if (run_program_and_log_output(tmp1, 2)) {
     
    12561239        if (i) {
    12571240            retval++;
    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);
    1259             log_to_screen(tmp2);
    1260             mr_free(tmp2);
     1241            log_to_screen(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);
    12611242        }
    12621243        unlink(tmp1);
     
    12971278
    12981279    if (flag_set['S']) {
    1299         mr_asprintf(tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);
    1300         mr_free(bkpinfo->scratchdir);
    1301         bkpinfo->scratchdir = tmp1;
     1280        mr_asprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);
    13021281    }
    13031282
     
    15101489            if (flag_set[opt]) {
    15111490                bad_switches = TRUE;
    1512                 mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    1513                 log_to_screen(tmp);
    1514                 mr_free(tmp);
     1491                log_to_screen("Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    15151492            } else {
    15161493                flag_set[opt] = TRUE;
     
    15261503                        if (strchr(flag_val[opt], '/')
    15271504                            && flag_val[opt][0] != '/') {
    1528                             mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    1529                             log_to_screen(tmp);
    1530                             mr_free(tmp);
     1505                            log_to_screen("-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    15311506                            bad_switches = TRUE;
    15321507                        }
     
    15391514    for (i = optind; i < argc; i++) {
    15401515        bad_switches = TRUE;
    1541         mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]);
    1542         log_to_screen(tmp);
    1543         mr_free(tmp);
     1516        log_to_screen("Invalid arg -- %s\n", argv[i]);
    15441517    }
    15451518    return (bad_switches);
     
    16151588    free_MR_global_filenames();
    16161589
    1617     fatal_error
    1618         ("MondoRescue is terminating in response to a signal from the OS");
     1590    fatal_error("MondoRescue is terminating in response to a signal from the OS");
    16191591    finish(254);                // just in case
    16201592}
     
    16291601void set_signals(int on)
    16301602{
    1631     int signals[] =
    1632         { SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT, SIGKILL, SIGSTOP, 0 };
     1603    int signals[] = { SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT, SIGKILL, SIGSTOP, 0 };
    16331604    int i;
    16341605
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2323 r2324  
    108108{
    109109    char *tmp = NULL;
    110     char *comment = NULL;
    111110    bool is_this_a_ramdisk = FALSE;
    112111
    113112    mr_asprintf(tmp, "%s", where_is_root_mounted());
    114     mr_asprintf(comment, "root is currently mounted at %s\n", tmp);
    115     log_msg(0, comment);
    116     mr_free(comment);
     113    log_msg(0, "root is currently mounted at %s\n", tmp);
    117114
    118115#ifdef __FreeBSD__
     
    221218        mr_asprintf(command, "cdcontrol -f %s eject", dev);
    222219    } else {
    223         mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`",
    224                 dev);
     220        mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`", dev);
    225221    }
    226222#else
     
    500496{
    501497    /*@ buffers ************************ */
    502     char *comment = NULL;
    503498    char *tmp = NULL;
    504499    char *cdr_exe = NULL;
     
    532527    } else {
    533528        strcpy(cdrw_device, tmp);
    534         mr_asprintf(comment, "Found CDRW device - %s", cdrw_device);
    535         log_it(comment);
     529        log_it("Found CDRW device - %s", cdrw_device);
    536530        strcpy(g_cdrw_drive_is_here, cdrw_device);
    537         mr_free(comment);
    538531        mr_free(tmp);
    539532        mr_free(cdr_exe);
     
    876869    }
    877870
    878     mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output
    879             ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
     871    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    880872        );
    881873    log_msg(5, "tmp = '%s'", tmp);
    882874    if (!tmp[0])
    883875        mr_free(tmp);
    884         mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output
    885                 ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
     876        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    886877            );
    887878    if (tmp[0]) {
     
    10901081    malloc_string(incoming);
    10911082    assert(device_raw != NULL);
    1092 //  assert_string_is_neither_NULL_nor_zerolength(device_raw);
    10931083    if (device_raw[0] != '/' && !strstr(device_raw, ":/")) {
    10941084        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
     
    13721362                log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir);
    13731363                mr_free(bkpinfo->isodir);
    1374                 mr_asprintf(p, "%s/isodir", bkpinfo->tmpdir);
    1375                 bkpinfo->isodir = p;
     1364                mr_asprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir);
    13761365            }
    13771366        }
     
    13871376                cd_number_i_want);
    13881377        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1389         mr_asprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want);
     1378        log_msg(3, "Insisting on %s #%d", mds, cd_number_i_want);
    13901379        mr_asprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);
    13911380        mr_free(mds);
    1392         log_msg(3, tmp);
    1393         mr_free(tmp);
    13941381
    13951382        while (what_number_cd_is_this() != cd_number_i_want) {
     
    17311718            mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount);
    17321719            mr_free(bkpinfo->isodir);
    1733             mr_asprintf(p, "%s", call_program_and_get_last_line_of_output(command));
    1734             bkpinfo->isodir = p;
     1720            mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(command));
    17351721            mr_free(command);
    17361722
     
    17721758        mr_free(bkpinfo->isodir);
    17731759        if (is_this_device_mounted(bkpinfo->nfs_mount)) {
    1774             mr_asprintf(p, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
    1775             bkpinfo->isodir = p;
     1760            mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
    17761761
    17771762        } else {
    1778             mr_asprintf(p, "%s/nfsdir", bkpinfo->tmpdir);
    1779             bkpinfo->isodir = p;
     1763            mr_asprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir);
    17801764            mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir);
    17811765            run_program_and_log_output(command, 5);
     
    17901774        }
    17911775        if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
    1792             popup_and_OK
    1793                 ("Please mount that partition before you try to backup to or restore from it.");
     1776            popup_and_OK("Please mount that partition before you try to backup to or restore from it.");
    17941777            finish(1);
    17951778        }
     
    21522135        fatal_error("I couldn't figure out the scratchdir!");
    21532136    }
    2154     mr_asprintf(sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
    21552137    mr_free(bkpinfo->scratchdir);
    2156     bkpinfo->scratchdir = sz;
     2138    mr_asprintf(bkpinfo->scratchdir , "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
    21572139    log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);
    21582140
     
    22282210
    22292211    assert(bkpinfo != NULL);
    2230 //  log_it("Asking what_number_cd_is_this");
     2212    //  log_it("Asking what_number_cd_is_this");
    22312213    if (g_ISO_restore_mode) {
    22322214        mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'");
    2233 
    22342215        mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
    22352216        cd_number = atoi(last_line_of_file(mountdev));
    2236         paranoid_free(mountdev);
    2237         paranoid_free(tmp);
     2217        mr_free(mountdev);
     2218        mr_free(tmp);
    22382219
    22392220        return (cd_number);
     
    22422223    mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    22432224    if (!mountdev[0]) {
    2244         log_it
    2245             ("(what_number_cd_is_this) Warning - media_device unknown. Finding out...");
     2225        log_it("(what_number_cd_is_this) Warning - media_device unknown. Finding out...");
    22462226        find_cdrom_device(bkpinfo->media_device, FALSE);
    22472227    }
     
    22532233        }
    22542234    }
    2255     paranoid_free(mountdev);
     2235    mr_free(mountdev);
    22562236
    22572237    cd_number = atoi(last_line_of_file(MNT_CDROM "/archives/THIS-CD-NUMBER"));
  • branches/2.2.10/mondo/src/common/libmondo-fifo.c

    r2323 r2324  
    9494    if (!res) {
    9595        bufsize++;
    96         mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize);
    97         log_to_screen(tmp);
    98         mr_free(tmp);
     96        log_to_screen(tmp, "Negotiated max buffer of %d MB ", bufsize);
    9997    } else {
    10098        bufsize = 0;
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2323 r2324  
    159159
    160160    mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
    161 
    162161    mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
    163162    retval = system(command);
     
    334333
    335334    if (curr_set_no == 0) {
    336         mr_asprintf(tmp, "Only one fileset. Fine.");
     335        log_msg(1, "Only one fileset. Fine.");
    337336    } else {
    338         mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1);
    339     }
    340     log_msg(1, tmp);
    341     mr_free(tmp);
     337        log_msg(1, "Filelist divided into %ld sets", curr_set_no + 1);
     338    }
    342339    close_evalcall_form();
    343340    /* This is to work around an obscure bug in Newt; open a form, close it,
     
    474471        paranoid_free(tmp);
    475472        mr_asprintf(syscall, "%s 2>> /dev/null", strtmp);   // " MONDO_LOGFILE);
    476         paranoid_free(strtmp);
     473        mr_free(strtmp);
    477474        call_exe_and_pipe_output_to_fd(syscall, pout);
    478         paranoid_free(syscall);
     475        mr_free(syscall);
    479476    }
    480477    paranoid_fclose(fin);
     
    14161413                    mr_asprintf(tmp, "Reading %-68s", dir);
    14171414                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    1418                     paranoid_free(tmp);
     1415                    mr_free(tmp);
    14191416                }
    14201417#endif
     
    14361433        mr_asprintf(tmp,"opendir %s", dir);
    14371434        log_OS_error(tmp);
    1438         paranoid_free(tmp);
     1435        mr_free(tmp);
    14391436    } else if (strstr(skip_these, new_with_spaces)) {
    14401437        fprintf(fout, "%s\n", dir); // if excluded dir then print dir ONLY
     
    14521449            if (strstr(skip_these, new_with_spaces)) {
    14531450                fprintf(fout, "%s\n", new);
    1454                 paranoid_free(new_with_spaces);
     1451                mr_free(new_with_spaces);
    14551452            } else {
    1456                 paranoid_free(new_with_spaces);
     1453                mr_free(new_with_spaces);
    14571454                if (!lstat(new, &statbuf)) {
    14581455                    if (!S_ISLNK(statbuf.st_mode)
     
    14711468#ifndef _XWIN
    14721469                                if (!g_text_mode) {
    1473                                     newtDrawRootText(77, g_noof_rows - 3,
    1474                                                      tmp);
     1470                                    newtDrawRootText(77, g_noof_rows - 3, tmp);
    14751471                                    newtRefresh();
    14761472                                }
    14771473#endif
    1478                                 paranoid_free(tmp);
     1474                                mr_free(tmp);
    14791475                            }
    14801476                        }
     
    15651561    mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    15661562    if (!include_paths && !userdef_filelist) {
    1567         fatal_error
    1568             ("Please supply either include_paths or userdef_filelist");
     1563        fatal_error("Please supply either include_paths or userdef_filelist");
    15691564    }
    15701565    // make hole for filelist
     
    15841579        // backup last known good datefile just in case :)
    15851580        if (does_file_exist(sz_datefile)) {
    1586             mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile,
    1587                     sz_datefile);
     1581            mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, sz_datefile);
    15881582            paranoid_system(command);
    15891583            mr_free(command);
     
    16261620            log_msg(2, "Found windows FS: %s",tmp2);
    16271621            mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    1628             paranoid_free(tmp2);
     1622            mr_free(tmp2);
    16291623            mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    16301624            log_msg(2, "Found windows files: %s",tmp2);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2323 r2324  
    4848    static char output[MAX_STR_LEN];
    4949    char *command = NULL;
    50     char *tmp = NULL;
    5150
    5251    /*@ pointers **************************************************** */
     
    7170        mr_free(command);
    7271    } else {
    73         mr_asprintf(tmp, "File '%s' not found; cannot calc checksum", filename);
    74         log_it(tmp);
    75         mr_free(tmp);
     72        log_it("File '%s' not found; cannot calc checksum", filename);
    7673    }
    7774    if (p) {
     
    129126    char *command = NULL;
    130127    char incoming[MAX_STR_LEN];
    131     char *tmp = NULL;
    132128
    133129    /*@ long ******************************************************** */
     
    142138    assert_string_is_neither_NULL_nor_zerolength(filename);
    143139    if (!does_file_exist(filename)) {
    144         mr_asprintf(tmp, "%s does not exist, so I cannot found the number of lines in it", filename);
    145         log_it(tmp);
    146         mr_free(tmp);
     140        log_it("%s does not exist, so I cannot found the number of lines in it", filename);
    147141        return (0);
    148142    }
     
    251245            fprintf(fout, "%s\n", incoming);
    252246        } else {
    253             mr_asprintf(tmp, "Excluding '%s'-nonexistent\n", incoming);
    254             log_it(tmp);
    255             mr_free(tmp);
     247            log_it("Excluding '%s'-nonexistent\n", incoming);
    256248        }
    257249    }
     
    354346        }
    355347        mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming);
    356         strcpy(incoming,
    357                call_program_and_get_last_line_of_output(command));
     348        strcpy(incoming, call_program_and_get_last_line_of_output(command));
    358349        mr_free(command);
    359350    }
     
    361352    {
    362353        mr_asprintf(command, "dirname %s 2> /dev/null", incoming);
    363         strcpy(incoming,
    364                call_program_and_get_last_line_of_output(command));
     354        strcpy(incoming, call_program_and_get_last_line_of_output(command));
    365355        mr_free(command);
    366356    }
     
    453443    if (i < 0) {
    454444        mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');
    455         strcpy(lastline,
    456                call_program_and_get_last_line_of_output(command));
     445        strcpy(lastline, call_program_and_get_last_line_of_output(command));
    457446        mr_free(command);
    458447        if (!lastline[0]) {
     
    495484    static char output[MAX_STR_LEN];
    496485    char *command = NULL;
    497     char *tmp = NULL;
    498486
    499487    /*@ pointers **************************************************** */
     
    503491
    504492    if (!does_file_exist(filename)) {
    505         mr_asprintf(tmp, "Tring to get last line of nonexistent file (%s)", filename);
    506         log_it(tmp);
    507         mr_free(tmp);
     493        log_it("Tring to get last line of nonexistent file (%s)", filename);
    508494        output[0] = '\0';
    509495        return (output);
     
    618604                /*              printf("%0d%% done      \r",percentage); */
    619605            } else {
    620                 time_remaining =
    621                     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);
    623                 log_to_screen(tmp);
    624                 mr_free(tmp);
     606                time_remaining = time_taken * 100 / (long) (percentage) - time_taken;
     607                log_to_screen("%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);
    625608            }
    626609            sync();
     
    820803                log_msg(4, "%s --> %ld K", fname, file_len_K);
    821804            }
    822             mr_asprintf(comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);
    823             log_msg(4, comment);
    824             mr_free(comment);
     805            log_msg(4, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);
    825806            if (feof(fin)) {
    826807                break;
     
    920901    /*@ buffers *** */
    921902    char *command = NULL;
    922     char *errorstr = NULL;
    923903    int res = 0;
    924904
     
    928908
    929909    if (res) {
    930         mr_asprintf(errorstr, "Please install '%s'. I cannot find it on your system.", fname);
    931         log_to_screen(errorstr);
    932         mr_free(errorstr);
     910        log_to_screen("Please install '%s'. I cannot find it on your system.", fname);
    933911        log_to_screen("There may be hyperlink at http://www.mondorescue.com which");
    934912        log_to_screen("will take you to the relevant (missing) package.");
     
    10311009    char *command = NULL;
    10321010    char tmp[MAX_STR_LEN];
    1033     char old_pwd[MAX_STR_LEN];
    10341011    int res = 0;
    10351012
     
    11241101    p = strchr(tmp, ':');
    11251102    if (!p) {
    1126         fatal_error
    1127             ("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs");
     1103        fatal_error("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs");
    11281104    }
    11291105    *(p++) = '\0';
     
    12291205
    12301206
    1231 
    1232 
    1233 
    1234 
    12351207/**
    12361208 * Determine the approximate number of media that the backup will take up,
  • branches/2.2.10/mondo/src/common/libmondo-fork.c

    r2323 r2324  
    252252    /*@ int ********************************************************* */
    253253    int res;
    254     int i;
    255254    bool log_if_failure = FALSE;
    256255    bool log_if_success = FALSE;
     
    354353
    355354    /*@ buffers **************************************************** */
    356     char *tmp = NULL;
    357355    char *command = NULL;
    358356    char *lockfile = NULL;
     
    367365    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);
    368366    open_evalcall_form(what_i_am_doing);
    369     mr_asprintf(tmp, "Executing %s", basic_call);
    370     log_msg(2, tmp);
    371     mr_free(tmp);
     367    log_msg(2, "Executing %s", basic_call);
    372368
    373369    if (!(fin = popen(command, "r"))) {
    374370        log_OS_error("Unable to popen-in command");
    375         mr_asprintf(tmp, "Failed utterly to call '%s'", command);
    376         log_to_screen(tmp);
    377         mr_free(tmp);
     371        log_to_screen("Failed utterly to call '%s'", command);
    378372        mr_free(command);
    379373        mr_free(lockfile);
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2323 r2324  
    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.",
    344                 amount_allocated - physical_drive_size, drive);
     343        mr_asprintf(tmp, " %ld MB over-allocated on %s.", amount_allocated - physical_drive_size, drive);
    345344        log_it(tmp);
    346345        mr_strcat(flaws_str, "%s", tmp);
     
    348347        res++;
    349348    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    350         mr_asprintf(tmp, " %ld MB unallocated on %s.",
    351                 physical_drive_size - amount_allocated, drive);
     349        mr_asprintf(tmp, " %ld MB unallocated on %s.", physical_drive_size - amount_allocated, drive);
    352350        log_it(tmp);
    353351        mr_strcat(flaws_str, "%s", tmp);
     
    403401        return(flaws_str);
    404402    } else {
    405         mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    406         log_it(tmp);
    407         mr_free(tmp);
     403        log_it("%s is %ld MB", drive, physical_drive_size);
    408404    }
    409405
     
    424420            } else if (curr_part_no > 5
    425421                       || (curr_part_no <= 4 && prev_part_no > 0)) {
    426                 mr_asprintf(tmp, " Gap on %s between %d and %d.", drive,
    427                         prev_part_no, curr_part_no);
     422                mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, prev_part_no, curr_part_no);
    428423                log_it(tmp);
    429424                mr_strcat(flaws_str, "%s", tmp);
     
    496491    /* Over-allocated the disk? Unallocated space on disk? */
    497492    if (amount_allocated > physical_drive_size + 1) {
    498         mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    499                 amount_allocated - physical_drive_size, drive);
     493        mr_asprintf(tmp, " %ld MB over-allocated on %s.", amount_allocated - physical_drive_size, drive);
    500494        log_it(tmp);
    501495        mr_strcat(flaws_str, "%s", tmp);
     
    503497        res++;
    504498    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    505         mr_asprintf(tmp, " %ld MB unallocated on %s.",
    506                 physical_drive_size - amount_allocated, drive);
     499        mr_asprintf(tmp, " %ld MB unallocated on %s.", physical_drive_size - amount_allocated, drive);
    507500        log_it(tmp);
    508501        mr_strcat(flaws_str, "%s", tmp);
     
    561554            (drivelist->el[i].device,
    562555             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);
    564             log_it(tmp);
    565             paranoid_free(tmp);
     556            log_it(" Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
    566557        } else {
    567558            log_msg(8, "Evaluating drive #%d (%s) within mountlist", i, drivelist->el[i].device);
     
    576567            log_msg(8,"Adding: %s to %s", tmp, flaws_str);
    577568            mr_strcat(flaws_str, "%s", tmp);
    578             paranoid_free(tmp);
     569            mr_free(tmp);
    579570        }
    580571    }
    581572    res += look_for_duplicate_mountpoints(mountlist, flaws_str);
    582573    res = spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C,res);
    583     paranoid_free(flaws_str);
     574    mr_free(flaws_str);
    584575    return(res);
    585576}
     
    654645            mr_strcat(flaws_str, "%s", tmp);
    655646            log_it(tmp);
    656             paranoid_free(tmp);
     647            mr_free(tmp);
    657648            res++;
    658649        }
    659         paranoid_free(curr_mountpoint);
     650        mr_free(curr_mountpoint);
    660651    }
    661652    return (res);
     
    693684        if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    694685            log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive);
    695             paranoid_free(drive);
     686            mr_free(drive);
    696687            continue;
    697688        }
     
    700691        if (size == 0) {
    701692            log_msg(8, "Not putting %s in list of drives: it has zero size (maybe an LVM volume)", drive);
    702             paranoid_free(drive);
     693            mr_free(drive);
    703694            continue;
    704695        }
     
    708699        /* memory allocation */
    709700        truncdrive = truncate_to_drive_name(drive);
    710         paranoid_free(drive);
     701        mr_free(drive);
    711702
    712703        log_msg(8, "drive truncated to %s", truncdrive);
     
    757748    int used_by = 0;
    758749
    759     /*@ buffers ********************************************************* */
    760     char *tmp = NULL;
    761 
    762750    assert(output_list != NULL);
    763751    assert(mountlist != NULL);
     
    769757    for (i = 0; i < mountlist->entries; i++) {
    770758        if (strstr(mountlist->el[i].mountpoint, "raid")) {
    771             used_by =
    772                 which_raid_device_is_using_this_partition(raidlist,
     759            used_by = which_raid_device_is_using_this_partition(raidlist,
    773760                                                          mountlist->el[i].
    774761                                                          device);
     
    777764                       (void *) &mountlist->el[i],
    778765                       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);
    780                 log_it(tmp);
    781                 paranoid_free(tmp);
     766                log_it("%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
    782767            }
    783768        }
     
    895880            if (j < items) {
    896881                strcat(mountlist->el[items].device, "_dup");
    897                 mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    898                 log_it(tmp);
    899                 paranoid_free(tmp);
     882                log_it("Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    900883            }
    901884            mr_asprintf(tmp, "%s", mountlist->el[items].device);
     
    10651048
    10661049    mountlist->el[b].size = size;
    1067     paranoid_free(device);
    1068     paranoid_free(mountpoint);
    1069     paranoid_free(format);
     1050    mr_free(device);
     1051    mr_free(mountpoint);
     1052    mr_free(format);
    10701053}
    10711054
  • branches/2.2.10/mondo/src/common/libmondo-raid.c

    r2323 r2324  
    471471{
    472472    FILE *fin;
    473     char *tmp1 = NULL;
    474473    int items;
    475474
     
    585584    fclose(fin);
    586585    log_it("Raidtab loaded successfully.");
    587     mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries);
    588     log_it(tmp1);
    589     mr_free(tmp1);
     586    log_it("%d RAID devices in raidtab", raidlist->entries);
    590587    return (0);
    591588}
     
    687684
    688685    /*@ add mallocs * */
    689     char *tmp = NULL;
    690686    char *labelB;
    691687    char *valueB;
     
    744740        }
    745741        if (!disklist) {
    746             mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
    747             log_it(tmp);
    748             mr_free(tmp);
     742            log_it("Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
    749743        } else {
    750744            index = atoi(valueB);
     
    10081002    mr_asprintf(strtmp, "%s", pos);
    10091003    strcpy(string, strtmp);
    1010     paranoid_free(strtmp);
     1004    mr_free(strtmp);
    10111005    // if we have newline after only spaces, this is a blank line, update
    10121006    // counters, otherwise do normal parsing
     
    10291023    mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10301024    strcpy(raidlist->el[raidlist->entries].raid_device, strtmp);
    1031     paranoid_free(strtmp);
     1025    mr_free(strtmp);
    10321026    mr_free(token);
    10331027    // skip ':' and status
     
    10881082        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10891083        strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp);
    1090         paranoid_free(strtmp);
     1084        mr_free(strtmp);
    10911085        raidlist->el[raidlist->entries].data_disks.entries++;
    10921086        break;
     
    10951089        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10961090        strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp);
    1097         paranoid_free(strtmp);
     1091        mr_free(strtmp);
    10981092        raidlist->el[raidlist->entries].spare_disks.entries++;
    10991093        break;
     
    11021096        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    11031097        strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp);
    1104         paranoid_free(strtmp);
     1098        mr_free(strtmp);
    11051099        raidlist->el[raidlist->entries].failed_disks.entries++;
    11061100        log_it("At least one failed disk found in RAID array.\n");
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2323 r2324  
    10121012{
    10131013    /*@ buffers ***************************************************** */
    1014     char *tmp = NULL;
    10151014    char *datablock;
    10161015    char *temp_fname;
    10171016    char *temp_cksum;
    10181017    char *actual_cksum = NULL;
    1019 //  char *pA, *pB;
    10201018
    10211019    /*@ int ********************************************************* */
     
    10581056    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    10591057    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);
    1061         log_to_screen(tmp);
    1062         mr_free(tmp);
     1058        log_to_screen("output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
    10631059    }
    10641060    if (ctrl_chr != BLK_START_FILE) {
     
    11311127    }
    11321128    if (strcmp(temp_cksum, actual_cksum)) {
    1133         mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
    1134         log_to_screen(tmp);
    1135         mr_free(tmp);
    1136 
    1137         mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    1138         log_to_screen(tmp);
    1139         mr_free(tmp);
    1140 
     1129        log_to_screen("actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
     1130        log_to_screen("%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    11411131        retval++;
    11421132    }
     
    15731563    /*@ pointers *************************************************** */
    15741564    FILE *fin;
    1575     char *tmp = NULL;
    15761565
    15771566    /*@ long ******************************************************* */
     
    15911580    log_it("Data disks = %s", fname);
    15921581    if (!does_file_exist(fname)) {
    1593         mr_asprintf(tmp, "Cannot find %s", fname);
    1594         log_to_screen(tmp);
    1595         mr_free(tmp);
     1582        log_to_screen("Cannot find %s", fname);
    15961583        return (1);
    15971584    }
     
    16361623{
    16371624    /*@ buffers **************************************************** */
    1638     char *tmp = NULL;
    16391625    char datablock[TAPE_BLOCK_SIZE];
    16401626    char *checksum = NULL;
     
    16891675        p++;
    16901676    }
    1691     mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    1692     log_it(tmp);
    1693     mr_free(tmp);
     1677    log_it("Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    16941678    write_header_block_to_stream(filesize, infile_basename,
    16951679                                 BLK_START_FILE);
     
    17611745    /*@ buffers **************************************************** */
    17621746    char tempblock[TAPE_BLOCK_SIZE];
    1763     char *tmp = NULL;
    17641747    char *p;
    17651748
     
    17801763    }
    17811764    if (!g_tape_stream) {
    1782         log_to_screen
    1783             ("You're not backing up to tape. Why write a tape header?");
     1765        log_to_screen("You're not backing up to tape. Why write a tape header?");
    17841766        return (1);
    17851767    }
     
    17911773    memcpy(tempblock + 7001, (char *) &olen, sizeof(off_t));
    17921774    strcpy(tempblock + 1000, filename);
    1793     g_tape_posK +=
    1794         fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    1795                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);
    1797     log_msg(6, tmp);
    1798     mr_free(tmp);
     1775    g_tape_posK += fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream) / 1024;
     1776    log_msg(6, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
    17991777    return (0);
    18001778}
     
    18161794void wrong_marker(int should_be, int it_is)
    18171795{
    1818     /*@ buffer ***************************************************** */
    1819     char *tmp = NULL;
    1820 
    1821 
    1822     /*@ end vars *************************************************** */
    1823     mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    1824     log_to_screen(tmp);
    1825     mr_free(tmp);
     1796    log_to_screen("Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    18261797}
    18271798
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2323 r2324  
    828828    bkpinfo->disaster_recovery = (am_I_in_disaster_recovery_mode()? TRUE : FALSE);
    829829    if (bkpinfo->disaster_recovery) {
    830         mr_asprintf(p, "%s", "/");
     830        mr_asprintf(bkpinfo->isodir, "%s", "/");
    831831    } else {
    832         mr_asprintf(p, "%s", MONDO_CACHE);
    833     }
    834     bkpinfo->isodir = p;
    835     mr_asprintf(p, "%s", STD_PREFIX);
    836     bkpinfo->prefix = p;
    837     bkpinfo->scratchdir = NULL;
    838     bkpinfo->tmpdir = NULL;
     832        mr_asprintf(bkpinfo->isodir, "%s", MONDO_CACHE);
     833    }
     834    mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
     835    bkpinfo->scratchdir = NULL;     // Really setup after
     836    bkpinfo->tmpdir = NULL;         // Really setup after
    839837    bkpinfo->optimal_set_size = 0;
    840838    bkpinfo->backup_media_type = none;
     
    889887    mr_free(command);
    890888
    891     mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
    892             partition);
     889    mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4", partition);
    893890    mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command));
    894891    mr_free(command);
     
    941938    }
    942939    if (atol(tmp) < 66000) {
    943         log_to_screen
    944             ("WARNING! You have very little RAM. Please upgrade to 64MB or more.");
     940        log_to_screen("WARNING! You have very little RAM. Please upgrade to 64MB or more.");
    945941    }
    946942    mr_free(tmp);
     
    10801076    /*@ buffer ****************************************************** */
    10811077    char *command = NULL;
    1082     char *tmp = NULL;
    10831078
    10841079    /*@ end vars *************************************************** */
     
    10871082    assert_string_is_neither_NULL_nor_zerolength(label);
    10881083    if (!does_file_exist(config_file)) {
    1089         mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file", config_file);
    1090         log_to_screen(tmp);
    1091         mr_free(tmp);
    1092 
     1084        log_to_screen("(read_cfg_var) Cannot find %s config file", config_file);
    10931085        value[0] = '\0';
    10941086        return (1);
     
    12521244                    strcpy(g_boot_mountpt, tmp);
    12531245                    mr_free(tmp);
    1254                     mr_asprintf(tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
    1255                     log_it(tmp);
    1256                     mr_free(tmp);
     1246                    log_it("%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
    12571247
    12581248                    mr_asprintf(tmp, "mount %s", g_boot_mountpt);
     
    13111301    char *command = NULL;
    13121302    char *tempfile = NULL;
    1313     char *tmp = NULL;
    13141303
    13151304
     
    13191308    assert(value != NULL);
    13201309    if (!does_file_exist(config_file)) {
    1321         mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file", config_file);
    1322         log_to_screen(tmp);
    1323         mr_free(tmp);
     1310        log_to_screen("(write_cfg_file) Cannot find %s config file", config_file);
    13241311        return (1);
    13251312    }
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2323 r2324  
    167167        } else {
    168168            retval++;
    169             mr_asprintf(tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1);
    170             log_to_screen(tmp);
    171             mr_free(tmp);
     169            log_to_screen("Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1);
    172170        }
    173171    }
     
    666664        if (strcmp(biggie_cksum, orig_cksum)) {
    667665            log_msg(2, "orig cksum=%s; curr cksum=%s", biggie_cksum, orig_cksum);
    668             mr_asprintf(tmp, "%s has changed on live filesystem", biggie_fname);
    669             log_to_screen(tmp);
    670             mr_free(tmp);
     666            log_to_screen("%s has changed on live filesystem", biggie_fname);
    671667
    672668            mr_asprintf(tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir);
     
    776772        res = verify_an_afioball_from_stream(fname, size);
    777773        if (res) {
    778             mr_asprintf(tmp, "Afioball %ld differs from live filesystem", current_afioball_number);
    779             log_to_screen(tmp);
    780             mr_free(tmp);
     774            log_to_screen("Afioball %ld differs from live filesystem", current_afioball_number);
    781775        }
    782776        retval += res;
     
    981975#endif
    982976    {
    983         mr_asprintf(tmp, "%s failed; unable to unmount USB device\n", tmp1);
    984         log_to_screen(tmp);
    985         paranoid_free(tmp);
     977        log_to_screen("%s failed; unable to unmount USB device\n", tmp1);
    986978        retval++;
    987979    } else {
    988980        log_msg(2, "OK, I've unmounted the USB device\n");
    989981    }
    990     paranoid_free(tmp1);
    991     paranoid_free(mountpoint);
     982    mr_free(tmp1);
     983    mr_free(mountpoint);
    992984    return (retval);
    993985}
     
    10531045        mddevice = make_vn(fname);
    10541046        if (ret) {
    1055             mr_asprintf(tmp, "make_vn of %s failed; unable to verify ISO\n", fname);
    1056             log_to_screen(tmp);
    1057             mr_free(tmp);
     1047            log_to_screen("make_vn of %s failed; unable to verify ISO\n", fname);
    10581048            mr_free(mountpoint);
    10591049            mr_free(fname);
     
    10651055#endif
    10661056        if (run_program_and_log_output(command, FALSE)) {
    1067             mr_asprintf(tmp, "%s failed; unable to mount ISO image\n", command);
    1068             log_to_screen(tmp);
    1069             mr_free(tmp);
     1057            log_to_screen("%s failed; unable to mount ISO image\n", command);
    10701058            mr_free(mountpoint);
    10711059            mr_free(command);
     
    10991087    ret += system(command);
    11001088    ret += kick_vn(mddevice);
    1101     if (ret)
     1089    if (ret) {
    11021090#else
    11031091    mr_asprintf(command, "umount %s", mountpoint);
    1104     if (system(command))
     1092    if (system(command)) {
    11051093#endif
    1106     {
    1107         mr_asprintf(tmp, "%s failed; unable to unmount ISO image\n", command);
    1108         log_to_screen(tmp);
    1109         mr_free(tmp);
     1094        log_to_screen("%s failed; unable to unmount ISO image\n", command);
    11101095
    11111096        retval++;
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2323 r2324  
    10791079        char *timeline_str = NULL;
    10801080        char *taskprogress = NULL;
    1081         char *tmp = NULL;
    10821081
    10831082        if (!g_text_mode) {
  • branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c

    r2323 r2324  
    362362        res = verify_data();
    363363        if (res < 0) {
    364             mr_asprintf(tmp, "%d difference%c found.", -res,
    365                     (-res != 1) ? 's' : ' ');
     364            mr_asprintf(tmp, "%d difference%c found.", -res, (-res != 1) ? 's' : ' ');
    366365            mr_asprintf(say_at_end, "%s", tmp);
    367366            log_to_screen(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

    r2323 r2324  
    484484                 fgets(incoming, MAX_STR_LEN - 1, fin));
    485485            if (!feof(fin)) {
    486                 mr_asprintf(tmp, "Investigating %s", old_mountlist->el[lino].device);
    487                 log_it(tmp);
    488                 mr_free(tmp);
     486                log_it("Investigating %s", old_mountlist->el[lino].device);
    489487
    490488                for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin)
     
    497495                        *p = '\0';
    498496                        for (p--; p > incoming && *(p - 1) > 32; p--);
    499                         mr_asprintf(tmp, "Extrapolating %s", p);
    500                         log_it(tmp);
    501                         mr_free(tmp);
     497                        log_it("Extrapolating %s", p);
    502498
    503499                        for (j = 0;
     
    518514                            new_mountlist->entries++;
    519515                        } else {
    520                             mr_asprintf(tmp, "Not adding %s to mountlist: it's already there", p);
    521                             log_it(tmp);
    522                             mr_free(tmp);
     516                            log_it("Not adding %s to mountlist: it's already there", p);
    523517                        }
    524518                    }
     
    585579  for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
    586580    mr_asprintf(strtmp, "%s", devices);
    587     paranoid_free(devices);
    588     mr_asprintf(devices, "%s %s", strtmp,
    589          raidlist->el[i].data_disks.el[j].device);
    590     paranoid_free(strtmp);
     581    mr_free(devices);
     582    mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].data_disks.el[j].device);
     583    mr_free(strtmp);
    591584  }
    592585  for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
    593586    mr_asprintf(strtmp, "%s", devices);
    594     paranoid_free(devices);
    595     mr_asprintf(devices, "%s %s", strtmp,
    596          raidlist->el[i].spare_disks.el[j].device);
    597     paranoid_free(strtmp);
     587    mr_free(devices);
     588    mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].spare_disks.el[j].device);
     589    mr_free(strtmp);
    598590  }
    599591  // translate RAID level
     
    613605  if (raidlist->el[i].parity != -1) {
    614606    mr_asprintf(strtmp, "%s", program);
    615     paranoid_free(program);
     607    mr_free(program);
    616608    switch(raidlist->el[i].parity) {
    617609    case 0:
     
    635627  if (raidlist->el[i].chunk_size != -1) {
    636628    mr_asprintf(strtmp, "%s", program);
    637     paranoid_free(program);
     629    mr_free(program);
    638630    mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);
    639     paranoid_free(strtmp);
     631    mr_free(strtmp);
    640632  }
    641633  if (raidlist->el[i].spare_disks.entries > 0) {
    642634    mr_asprintf(strtmp, "%s", program);
    643     paranoid_free(program);
     635    mr_free(program);
    644636    mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries);
    645     paranoid_free(strtmp);
     637    mr_free(strtmp);
    646638  }
    647639  mr_asprintf(strtmp, "%s", program);
    648   paranoid_free(program);
     640  mr_free(program);
    649641  mr_asprintf(program, "%s %s", strtmp, devices);
    650   paranoid_free(strtmp);
     642  mr_free(strtmp);
    651643  res = run_program_and_log_output(program, 1);
    652   // free memory
    653   paranoid_free(devices);
    654   paranoid_free(level);
    655   paranoid_free(program);
    656   // return to calling instance
     644  mr_free(devices);
     645  mr_free(level);
     646  mr_free(program);
    657647  return res;
    658648}
     
    688678
    689679    if (strstr(format, "raid")) {   // do not form RAID disks; do it to /dev/md* instead
    690         mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device);
    691         log_it(tmp);
    692         mr_free(tmp);
     680        log_it("Not formatting %s (it is a RAID disk)", device);
    693681        return (0);
    694682    }
     
    700688#endif
    701689    if (strlen(format) <= 2) {
    702         mr_asprintf(tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);
    703         log_it(tmp);
    704         mr_free(tmp);
     690        log_it("%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);
    705691        return (0);
    706692    }
    707693    if (is_this_device_mounted(device)) {
    708         mr_asprintf(tmp, "%s is mounted - cannot format it       ", device);
    709         log_to_screen(tmp);
    710         mr_free(tmp);
     694        log_to_screen("%s is mounted - cannot format it       ", device);
    711695        return (1);
    712696    }
     
    736720            char line[MAX_STR_LEN];
    737721
    738             mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device);
    739             log_to_screen(tmp);
    740             mr_free(tmp);
     722            log_to_screen("Initializing Vinum device %s (this may take a *long* time)", device);
    741723
    742724            /* format raid partition */
     
    782764        }
    783765#else
    784         mr_asprintf(tmp, "Initializing RAID device %s", device);
     766        log_to_screen(tmp, "Initializing RAID device %s", device);
    785767        log_to_screen(tmp);
    786768        mr_free(tmp);
     
    989971        me = &mountlist->el[lino];  // the current mountlist entry
    990972        if (!strcmp(me->mountpoint, "image")) {
    991             mr_asprintf(tmp, "Not formatting %s - it's an image", me->device);
    992             log_it(tmp);
    993             mr_free(tmp);
     973            log_it("Not formatting %s - it's an image", me->device);
    994974        } else if (!strcmp(me->format, "raid")) {
    995             mr_asprintf(tmp, "Not formatting %s - it's a raid-let", me->device);
    996             log_it(tmp);
    997             mr_free(tmp);
     975            log_it("Not formatting %s - it's a raid-let", me->device);
    998976            continue;
    999977        } else if (!strcmp(me->format, "lvm")) {
    1000             mr_asprintf(tmp, "Not formatting %s - it's an LVM", me->device);
    1001             log_it(tmp);
    1002             mr_free(tmp);
     978            log_it("Not formatting %s - it's an LVM", me->device);
    1003979            continue;
    1004980        } else if (!strncmp(me->device, "/dev/md", 7)) {
    1005             mr_asprintf(tmp, "Already formatted %s - it's a soft-RAID dev", me->device);
    1006             log_it(tmp);
    1007             mr_free(tmp);
     981            log_it("Already formatted %s - it's a soft-RAID dev", me->device);
    1008982            continue;
    1009983        } else if (!does_file_exist(me->device)
    1010984                   && strncmp(me->device, "/dev/hd", 7)
    1011985                   && strncmp(me->device, "/dev/sd", 7)) {
    1012             mr_asprintf(tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device);
    1013             log_it(tmp);
    1014             mr_free(tmp);
     986            log_it("Not formatting %s yet - doesn't exist - probably an LVM", me->device);
    1015987            continue;
    1016988        } else {
     
    10481020    }
    10491021
    1050     mr_asprintf(tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully");
    1051     log_it(tmp);
    1052     mr_free(tmp);
     1022    log_it("format_everything () - %s", (retval) ? "failed!" : "finished successfully");
    10531023
    10541024    if (g_partition_table_locked_up > 0) {
     
    11031073    int res;
    11041074
    1105     /** buffers **********************************************************/
    1106     char *tmp = NULL;
    1107 
    11081075    /** end **************************************************************/
    11091076
     
    11111078
    11121079    if (devno_we_must_allow_for >= 5) {
    1113         mr_asprintf(tmp, "Making dummy primary 1 on %s", drivename);
    1114         log_it(tmp);
    1115         mr_free(tmp);
     1080        log_it("Making dummy primary 1 on %s", drivename);
    11161081
    11171082        g_maximum_progress++;
     
    11271092    }
    11281093    for (; current_devno < devno_we_must_allow_for; current_devno++) {
    1129         mr_asprintf(tmp, "Creating dummy partition %d on %s", current_devno, drivename);
    1130         log_it(tmp);
    1131         mr_free(tmp);
     1094        log_it("Creating dummy partition %d on %s", current_devno, drivename);
    11321095        g_maximum_progress++;
    11331096        res =
     
    14681431    malloc_string(format);
    14691432
    1470     mr_asprintf(tmp, "Partitioning drive %s", drivename);
    1471     log_it(tmp);
    1472     mr_free(tmp);
     1433    log_it("Partitioning drive %s", drivename);
    14731434
    14741435#if __FreeBSD__
     
    15651526            file = open(drivename, O_WRONLY);
    15661527            if (file != -1) {
    1567                 mr_asprintf(tmp, "Warning - unable to open %s for wiping it's partition table", drivename);
    1568                 log_to_screen(tmp);
    1569                 mr_free(tmp);
     1528                log_to_screen("Warning - unable to open %s for wiping it's partition table", drivename);
    15701529            }
    15711530
    15721531            for (i = 0; i < 512; i++) {
    15731532                if (!write(file, "\0", 1)) {
    1574                     mr_asprintf(tmp, "Warning - unable to write to %s", drivename);
    1575                     log_to_screen(tmp);
    1576                     mr_free(tmp);
     1533                    log_to_screen("Warning - unable to write to %s", drivename);
    15771534                }
    15781535            }
     
    16331590
    16341591    if (pout_to_fdisk) {
    1635 // mark relevant partition as bootable
     1592        // mark relevant partition as bootable
    16361593        mr_asprintf(tmp, "a\n%s\n", call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy"));
    16371594        fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    16381595        mr_free(tmp);
    16391596
    1640 // close fdisk
     1597        // close fdisk
    16411598        fput_string_one_char_at_a_time(pout_to_fdisk, "w\n");
    16421599        system("sync");
     
    17081665
    17091666    if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    1710         mr_asprintf(tmp, "Not partitioning %s - it is a virtual drive", drive);
    1711         log_it(tmp);
    1712         mr_free(tmp);
    1713 
     1667        log_it("Not partitioning %s - it is a virtual drive", drive);
    17141668        return (0);
    17151669    }
     
    17251679
    17261680    if (is_this_device_mounted(partition_name)) {
    1727         mr_asprintf(tmp, "%s is mounted, and should not be partitioned", partition_name);
    1728         log_to_screen(tmp);
    1729         mr_free(tmp);
     1681        log_to_screen("%s is mounted, and should not be partitioned", partition_name);
    17301682        mr_free(partition_name);
    17311683        return (1);
     
    17691721    }
    17701722    mr_strcat(output, "\n");
    1771     mr_asprintf(tmp,"PARTSIZE = +%ld",(long)partsize);
    1772     log_it(tmp);
    1773     mr_free(tmp);
     1723    log_it("PARTSIZE = +%ld",(long)partsize);
    17741724
    17751725    log_it("---fdisk command---");
     
    18261776                                 format, -1);
    18271777            if (res) {
    1828                 mr_asprintf(tmp, "Failed to vacuum-pack %s", partition_name);
    1829                 log_it(tmp);
    1830                 mr_free(tmp);
     1778                log_it("Failed to vacuum-pack %s", partition_name);
    18311779
    18321780                retval++;
     
    18401788                                   partsize);
    18411789            if (retval) {
    1842                 mr_asprintf(tmp, "Partitioned %s but failed to set its type", partition_name);
    1843                 log_it(tmp);
    1844                 mr_free(tmp);
     1790                log_it("Partitioned %s but failed to set its type", partition_name);
    18451791            } else {
    18461792                if (partsize > 0) {
    1847                     mr_asprintf(tmp, "Partition %s created+configured OK", partition_name);
    1848                     log_to_screen(tmp);
    1849                     mr_free(tmp);
     1793                    log_to_screen("Partition %s created+configured OK", partition_name);
    18501794                } else {
    18511795                    log_it("Returning from a successful vacuum-pack");
     
    24252369        return;
    24262370    }
    2427     mr_asprintf(tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);
    2428     log_to_screen(tmp);
    2429     mr_free(tmp);
     2371    log_to_screen("Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);
    24302372
    24312373    drivemntlist = malloc(sizeof(struct mountlist_reference));
     
    24452387
    24462388    if (original_size_of_drive <= 0) {
    2447         mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
    2448         log_to_screen(tmp);
    2449         mr_free(tmp);
     2389        log_to_screen("Cannot resize %s's entries. Drive not found.", drive_name);
    24502390        return;
    24512391    }
    24522392    factor = (float) (current_size_of_drive) / (float) (original_size_of_drive);
    2453     mr_asprintf(tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor);
    2454     log_to_screen(tmp);
    2455     mr_free(tmp);
     2393    log_to_screen("Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor);
    24562394
    24572395    lastpart = drivemntlist->entries - 1;
     
    24782416        }
    24792417
    2480         mr_asprintf(tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
    2481         log_to_screen(tmp);
    2482         mr_free(tmp);
     2418        log_to_screen("Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
    24832419        drivemntlist->el[partno]->size = newsizL;
    24842420    }
    24852421    final_size = get_phys_size_of_drive(drive_name);
    2486     mr_asprintf(tmp, "final_size = %ld MB", final_size);
    2487     log_to_screen(tmp);
    2488     mr_free(tmp);
     2422    log_to_screen("final_size = %ld MB", final_size);
    24892423}
    24902424
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2323 r2324  
    7979            insist_on_this_cd_number((++g_current_media_number));
    8080        } else {
    81             mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");
    82             log_msg(2, tmp_ptr);
    83             paranoid_free(tmp_ptr);
     81            log_msg(2, "No CD's left. No biggiefiles left. No prob, Bob.");
    8482            return (0);
    8583        }
    8684    }
    8785    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
    88         mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
    89         log_to_screen(tmp_ptr);
    90         paranoid_free(tmp_ptr);
     86        log_to_screen("Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
    9187        return (1);
    9288    }
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2323 r2324  
    272272    if (!bkpinfo->isodir[0]) {
    273273        mr_free(bkpinfo->isodir);
    274         mr_asprintf(p, "/tmp/isodir");
    275         bkpinfo->isodir = p;
     274        mr_asprintf(bkpinfo->isodir, "/tmp/isodir");
    276275    }
    277276    /* End patch */
     
    498497                "Again with the /proc - why is this in your mountlist?");
    499498        } else if (is_this_device_mounted(mountlist->el[lino].device)) {
    500             mr_asprintf(tmp, "%s is already mounted", mountlist->el[lino].device);
    501             log_to_screen(tmp);
    502             mr_free(tmp);
     499            log_to_screen("%s is already mounted", mountlist->el[lino].device);
    503500        } else if (strcmp(mountlist->el[lino].mountpoint, "none")
    504501           && strcmp(mountlist->el[lino].mountpoint, "lvm")
     
    595592        if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) {
    596593            mr_free(bkpinfo->isodir);
    597             mr_asprintf(p, "/tmp/isodir");
    598             bkpinfo->isodir = p;
     594            mr_asprintf(bkpinfo->isodir, "/tmp/isodir");
    599595            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    600596        }
     
    772768    mr_free(bkpinfo->prefix);
    773769    if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    774         mr_asprintf(tmp1, "%s", value);
    775     } else {
    776         mr_asprintf(tmp1, "%s", STD_PREFIX);
    777     }
    778     bkpinfo->prefix = tmp1;
     770        mr_asprintf(bkpinfo->prefix, "%s", value);
     771    } else {
     772        mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
     773    }
    779774} else if (!strcmp(value, "nfs")) {
    780775    bkpinfo->backup_media_type = nfs;
     
    782777    mr_free(bkpinfo->prefix);
    783778    if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    784         mr_asprintf(tmp1, "%s", value);
    785     } else {
    786         mr_asprintf(tmp1, "%s", STD_PREFIX);
    787     }
    788     bkpinfo->prefix = tmp1;
     779        mr_asprintf(bkpinfo->prefix, "%s", value);
     780    } else {
     781        mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
     782    }
    789783
    790784    if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) {
     
    796790        }
    797791        mr_free(bkpinfo->prefix);
    798         mr_asprintf(tmp1, "%s", envtmp1);
    799         bkpinfo->prefix = tmp1;
     792        mr_asprintf(bkpinfo->prefix, "%s", envtmp1);
    800793    }
    801794
     
    970963    read_cfg_var(g_mondo_cfg_file, "isodir", iso_path);
    971964    mr_free(bkpinfo->isodir);
    972     mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path);
    973     bkpinfo->isodir = tmp1;
     965    mr_asprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);
    974966    if (!bkpinfo->isodir[0]) {
    975967        mr_free(bkpinfo->isodir);
     
    20122004        }
    20132005        mr_asprintf(tmp, "Unmounting device %s  ", mountlist->el[lino].device);
    2014 
    20152006        update_progress_form(tmp);
    20162007
     
    21942185            }
    21952186            mr_asprintf(tmp, "%s", bkpinfo->media_device);
    2196             if (extract_cfg_file_and_mountlist_from_tape_dev
    2197                 (bkpinfo->media_device)) {
     2187            if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    21982188                strcpy(bkpinfo->media_device, "/dev/st0");
    2199                 if (extract_cfg_file_and_mountlist_from_tape_dev
    2200                     (bkpinfo->media_device)) {
     2189                if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    22012190                    strcpy(bkpinfo->media_device, "/dev/osst0");
    2202                     if (extract_cfg_file_and_mountlist_from_tape_dev
    2203                         (bkpinfo->media_device)) {
     2191                    if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    22042192                        strcpy(bkpinfo->media_device, "/dev/ht0");
    2205                         if (extract_cfg_file_and_mountlist_from_tape_dev
    2206                             (bkpinfo->media_device)) {
    2207                             log_msg(3,
    2208                                     "I tried lots of devices but none worked.");
     2193                        if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
     2194                            log_msg(3, "I tried lots of devices but none worked.");
    22092195                            strcpy(bkpinfo->media_device, tmp);
    22102196                        }
     
    23432329/* @} - end restoreUtilityGroup */
    23442330
    2345 
    2346 /***************************************************************************
    2347  * F@                                                                      *
    2348  * () -- Hugo Rabson                                  *
    2349  *                                                                         *
    2350  * Purpose:                                                                *
    2351  *                                                                         *
    2352  * Called by:                                                              *
    2353  * Params:    -                      -                                     *
    2354  * Returns:   0=success; nonzero=failure                                   *
    2355  ***************************************************************************/
    2356 
    2357 
    2358 
    23592331void wait_until_software_raids_are_prepped(char *mdstat_file,
    23602332                                           int wait_for_percentage)
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2323 r2324  
    918918        popup_and_OK(tmp);
    919919        mr_free(tmp);
    920         log_to_screen
    921           ("Mondo has restored your system. Please wait for the command prompt.");
    922         log_to_screen
    923             ("Then remove the backup media and reboot.");
    924         log_to_screen
    925             ("Please visit our website at http://www.mondorescue.org for more information.");
     920        log_to_screen("Mondo has restored your system. Please wait for the command prompt.");
     921        log_to_screen("Then remove the backup media and reboot.");
     922        log_to_screen("Please visit our website at http://www.mondorescue.org for more information.");
    926923    }
    927924    g_I_have_just_nuked = TRUE;
     
    11591156        use_ntfsprog_hack = TRUE;
    11601157        log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname);
    1161         mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    1162                 (int) (random() % 32768));
     1158        mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), (int) (random() % 32768));
    11631159        mkfifo(sz_devfile, 0x770);
    11641160        strcpy(ntfsprog_fifo, sz_devfile);
     
    12321228            mr_free(mds);
    12331229
    1234             mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number);
    1235             log_to_screen(tmp);
    1236             mr_free(tmp);
     1230            log_to_screen("Restoring from %s #%d", mds, g_current_media_number);
    12371231
    12381232            insist_on_this_cd_number(g_current_media_number);
     
    12791273            mr_free(tmp);
    12801274            if (bzip2_command != NULL) {
    1281                 mr_strcat(bzip2_command, " -dc %s 2>> %s",
    1282                         slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
     1275                mr_strcat(bzip2_command, " -dc %s 2>> %s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
    12831276            } else {
    1284                 mr_asprintf(bzip2_command, "cat %s 2>> %s",
    1285                         slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
     1277                mr_asprintf(bzip2_command, "cat %s 2>> %s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
    12861278            }
    12871279            mds = media_descriptor_string(bkpinfo->backup_media_type);
     
    16271619    char *executable = NULL;
    16281620    char *temp_log = NULL;
    1629     char *screen_message = NULL;
    16301621    long matches = 0;
    16311622    bool use_star;
     
    16541645        log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname));
    16551646        log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname));
    1656         mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);
    1657         log_to_screen(tmp);
    1658         mr_free(tmp);
     1647        log_to_screen("Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);
    16591648        mr_free(filelist_name);
    16601649        log_msg(5, "Leaving");
     
    16721661            log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname);
    16731662        }
    1674         mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);
    1675         log_to_screen(screen_message);
    1676         mr_free(screen_message);
     1663        log_to_screen("Tarball #%ld --- %ld matches", current_tarball_number, matches);
    16771664    }
    16781665    mr_free(filelist_name);
     
    20662053            } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
    20672054                insist_on_this_cd_number(++g_current_media_number);
    2068                 mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number);
    2069                 log_to_screen(tmp1);
    2070                 mr_free(tmp1);
     2055                log_to_screen("Restoring from %s #%d", mds, g_current_media_number);
    20712056                just_changed_cds = TRUE;
    20722057            } else {
     
    22282213        } else {
    22292214            mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);
    2230             for (res = 999, attempts = 0; attempts < 3 && res != 0;
    2231                  attempts++) {
    2232                 res =
    2233                     restore_a_tarball_from_CD(tarball_fname,
    2234                                               current_tarball_number,
    2235                                               filelist);
     2215            for (res = 999, attempts = 0; attempts < 3 && res != 0; attempts++) {
     2216                res = restore_a_tarball_from_CD(tarball_fname, current_tarball_number, filelist);
    22362217            }
    22372218            mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);
     
    22472228            }
    22482229            strcpy(comment, tmp1);
    2249             paranoid_free(tmp1);
     2230            mr_free(tmp1);
    22502231            if (attempts > 1) {
    22512232                log_to_screen(comment);
     
    25192500        retval += res;
    25202501        if (res) {
    2521             mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number);
    2522             log_to_screen(tmp);
    2523             mr_free(tmp);
     2502            log_to_screen("Fileset %ld - errors occurred", current_afioball_number);
    25242503        }
    25252504        res =
     
    29582937                log_msg(1, "Mounting nfs dir");
    29592938                mr_free(bkpinfo->isodir);
    2960                 mr_asprintf(tmp, "/tmp/isodir");
    2961                 bkpinfo->isodir = tmp;
     2939                mr_asprintf(bkpinfo->isodir, "/tmp/isodir");
    29622940                run_program_and_log_output("mkdir -p /tmp/isodir", 5);
    29632941                mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);
     
    29682946
    29692947        if (retval) {
    2970             log_to_screen
    2971                 ("Warning - load_raidtab_into_raidlist returned an error");
     2948            log_to_screen("Warning - load_raidtab_into_raidlist returned an error");
    29722949        }
    29732950
     
    30793056    set_signals(FALSE);
    30803057    log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE);
    3081     mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d)                                      ", retval);
    3082     log_to_screen(tmp);
    3083     mr_free(tmp);
     3058    log_to_screen("Mondo-restore is exiting (retval=%d)                                      ", retval);
    30843059
    30853060    mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
Note: See TracChangeset for help on using the changeset viewer.