Ignore:
Timestamp:
Aug 18, 2009, 3:05:43 PM (15 years ago)
Author:
Bruno Cornec
Message:

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

  • Change mr_asprintf interface to pass only the char * (makes bkpinfo usage more easy)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2321 r2323  
    280280        }
    281281        if (g_ISO_restore_mode) {
    282             mr_asprintf(&tmp, "umount %s", bkpinfo->isodir);
     282            mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
    283283            run_program_and_log_output(tmp, FALSE);
    284284            mr_free(tmp);
     
    361361
    362362    /* Clean up blkid cache file if they exist */
    363     mr_asprintf(&tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);
     363    mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);
    364364    (void)unlink(tmp1);
    365365    paranoid_free(tmp1);
    366     mr_asprintf(&tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
     366    mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
    367367    (void)unlink(tmp1);
    368368    paranoid_free(tmp1);
     
    376376
    377377    /* Clean up multiconf cache file if they exist */
    378     mr_asprintf(&tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
     378    mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
    379379    (void)unlink(tmp1);
    380380    paranoid_free(tmp1);
    381381
    382382    /* Edit multipath.conf if needed to adapt wwid */
    383     mr_asprintf(&tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
     383    mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
    384384    if (does_file_exist(tmp1)) {
    385385        log_msg(2, "We may need to clean /etc/multipath.conf");
     
    391391
    392392    if (bkpinfo->restore_mode != nuke) {
    393         mr_asprintf(&editor, "%s", find_my_editor());
    394         mr_asprintf(&tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
     393        mr_asprintf(editor, "%s", find_my_editor());
     394        mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
    395395        popup_and_OK("You will now edit multipath.conf");
    396396        if (!g_text_mode) {
     
    490490        if (g_text_mode) {
    491491            save_mountlist_to_disk(mountlist, g_mountlist_fname);
    492             mr_asprintf(&tmp1, "%s %s", find_my_editor(), g_mountlist_fname);
     492            mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname);
    493493            res = system(tmp1);
    494494            mr_free(tmp1);
     
    663663            strcpy(fstab_fname, "/tmp/fstab");
    664664        }
    665         mr_asprintf(&tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);
     665        mr_asprintf(tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);
    666666        res = system(tmp1);
    667667        mr_free(tmp1);
     
    780780    assert(raidlist != NULL);
    781781
    782     mr_asprintf(&tmpA, "%s", "         ");
    783     mr_asprintf(&tmpB, "%s", "         ");
    784     mr_asprintf(&tmpC, "%s", "         ");
     782    mr_asprintf(tmpA, "%s", "         ");
     783    mr_asprintf(tmpB, "%s", "         ");
     784    mr_asprintf(tmpC, "%s", "         ");
    785785
    786786    log_msg(2, "nuke_mode --- starting");
     
    803803    }
    804804    if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) {
    805         mr_asprintf(&tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);
     805        mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);
    806806        res = ask_me_yes_or_no(tmp);
    807807        mr_free(tmp);
     
    895895                        "Using tune2fs to identify your ext2,3 partitions");
    896896
    897     mr_asprintf(&tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);
     897    mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);
    898898    res = run_program_and_log_output(tmp, TRUE);
    899899    mr_free(tmp);
     
    915915            ("Please visit our website at http://www.mondorescue.org for more information.");
    916916    } else {
    917         mr_asprintf(&tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");
     917        mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");
    918918        popup_and_OK(tmp);
    919919        mr_free(tmp);
     
    11211121    if (!strncmp(biggiestruct.filename, "/dev/", 5))    // Whether NTFS or not :)
    11221122    {
    1123         mr_asprintf(&outfile_fname, "%s", biggiestruct.filename);
     1123        mr_asprintf(outfile_fname, "%s", biggiestruct.filename);
    11241124    } else {
    1125         mr_asprintf(&outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
     1125        mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
    11261126    }
    11271127
     
    11591159        use_ntfsprog_hack = TRUE;
    11601160        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),
     1161        mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    11621162                (int) (random() % 32768));
    11631163        mkfifo(sz_devfile, 0x770);
     
    12321232            mr_free(mds);
    12331233
    1234             mr_asprintf(&tmp, "Restoring from %s #%d", mds, g_current_media_number);
     1234            mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number);
    12351235            log_to_screen(tmp);
    12361236            mr_free(tmp);
     
    12391239            log_to_screen("Continuing to restore.");
    12401240        } else {
    1241             mr_asprintf(&tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));
     1241            mr_asprintf(tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));
    12421242            if (does_file_exist(tmp) && length_of_file(tmp) == 0) {
    12431243                log_msg(2,
     
    12511251                    (slice_fname
    12521252                     (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) {
    1253                     mr_asprintf(&bzip2_command, "lzop");
     1253                    mr_asprintf(bzip2_command, "lzop");
    12541254                    strcpy(suffix, "lzo");
    12551255                } else
     
    12571257                        (slice_fname
    12581258                         (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) {
    1259                     mr_asprintf(&bzip2_command, "gzip");
     1259                    mr_asprintf(bzip2_command, "gzip");
    12601260                    strcpy(suffix, "gz");
    12611261                } else
     
    12631263                        (slice_fname
    12641264                         (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) {
    1265                     mr_asprintf(&bzip2_command, "bzip2");
     1265                    mr_asprintf(bzip2_command, "bzip2");
    12661266                    strcpy(suffix, "bz2");
    12671267                } else
     
    12691269                        (slice_fname
    12701270                         (bigfileno, sliceno, ARCHIVES_PATH, ""))) {
    1271                     mr_asprintf(&bzip2_command, "");
     1271                    mr_asprintf(bzip2_command, "");
    12721272                    strcpy(suffix, "");
    12731273                } else {
     
    12821282                        slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
    12831283            } else {
    1284                 mr_asprintf(&bzip2_command, "cat %s 2>> %s",
     1284                mr_asprintf(bzip2_command, "cat %s 2>> %s",
    12851285                        slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
    12861286            }
    12871287            mds = media_descriptor_string(bkpinfo->backup_media_type);
    1288             mr_asprintf(&tmp, "Working on %s #%d, file #%ld, slice #%ld    ", mds, g_current_media_number, bigfileno + 1, sliceno);
     1288            mr_asprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld    ", mds, g_current_media_number, bigfileno + 1, sliceno);
    12891289            mr_free(mds);
    12901290            log_msg(2, tmp);
     
    13211321    if (use_ntfsprog_hack) {
    13221322        log_msg(3, "Waiting for ntfsclone to finish");
    1323         mr_asprintf(&tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
     1323        mr_asprintf(tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    13241324        while (system(tmp) == 0) {
    13251325            sleep(1);
     
    14521452    if (use_ntfsprog) {
    14531453        g_loglevel = 4;
    1454         mr_asprintf(&outfile_fname, "%s", orig_bf_fname);
     1454        mr_asprintf(outfile_fname, "%s", orig_bf_fname);
    14551455        use_ntfsprog_hack = TRUE;
    14561456        log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname);
    1457         mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
     1457        mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
    14581458        mkfifo(sz_devfile, 0x770);
    14591459        strcpy(ntfsprog_fifo, sz_devfile);
     
    14751475        if (!strncmp(orig_bf_fname, "/dev/", 5))    {
    14761476            // non-NTFS partition
    1477             mr_asprintf(&outfile_fname, "%s", orig_bf_fname);
     1477            mr_asprintf(outfile_fname, "%s", orig_bf_fname);
    14781478        } else {
    14791479            // biggiefile
    1480             mr_asprintf(&outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);
     1480            mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);
    14811481        }
    14821482        use_ntfsprog_hack = FALSE;
     
    14921492    if (dummy_restore) {
    14931493        mr_free(outfile_fname);
    1494         mr_asprintf(&outfile_fname, "/dev/null");
     1494        mr_asprintf(outfile_fname, "/dev/null");
    14951495    }
    14961496
    14971497    if (!bkpinfo->zip_exe[0]) {
    1498         mr_asprintf(&command, "cat > \"%s\"", file_to_openout);
     1498        mr_asprintf(command, "cat > \"%s\"", file_to_openout);
    14991499    } else {
    1500         mr_asprintf(&command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);
     1500        mr_asprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);
    15011501        if (strcmp(bkpinfo->zip_exe, "gzip") == 0) {
    15021502            /* Ignore SIGPIPE for gzip as it causes errors on big files
     
    15681568    if (use_ntfsprog_hack) {
    15691569        log_msg(3, "Waiting for ntfsclone to finish");
    1570         mr_asprintf(&tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
     1570        mr_asprintf(tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    15711571        while (system(tmp1) == 0) {
    15721572            sleep(1);
     
    16371637    log_msg(5, "Entering");
    16381638    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
    1639     mr_asprintf(&command, "mkdir -p %s/tmp", MNT_RESTORING);
     1639    mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING);
    16401640    run_program_and_log_output(command, 9);
    16411641    paranoid_free(command);
    16421642
    1643     mr_asprintf(&filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);
     1643    mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);
    16441644    if (length_of_file(filelist_name) <= 2) {
    16451645        log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name);
     
    16541654        log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname));
    16551655        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);
     1656        mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);
    16571657        log_to_screen(tmp);
    16581658        mr_free(tmp);
     
    16631663
    16641664    if (filelist) {
    1665         mr_asprintf(&filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);
     1665        mr_asprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);
    16661666        if ((matches =
    16671667             save_filelist_entries_in_common(filelist_name, filelist,
     
    16721672            log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname);
    16731673        }
    1674         mr_asprintf(&screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);
     1674        mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);
    16751675        log_to_screen(screen_message);
    16761676        mr_free(screen_message);
     
    16801680    if (filelist == NULL || matches > 0) {
    16811681        if (g_getfattr) {
    1682             mr_asprintf(&xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
     1682            mr_asprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
    16831683        }
    16841684        if (g_getfacl) {
    1685             mr_asprintf(&acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
     1685            mr_asprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
    16861686        }
    16871687        if (strstr(tarball_fname, ".bz2")) {
    1688             mr_asprintf(&executable, "bzip2");
     1688            mr_asprintf(executable, "bzip2");
    16891689        } else if (strstr(tarball_fname, ".gz")) {
    1690             mr_asprintf(&executable, "gzip");
     1690            mr_asprintf(executable, "gzip");
    16911691        } else if (strstr(tarball_fname, ".lzo")) {
    1692             mr_asprintf(&executable, "lzop");
     1692            mr_asprintf(executable, "lzop");
    16931693        }
    16941694        if (executable) {
    1695             mr_asprintf(&tmp, "which %s > /dev/null 2> /dev/null", executable);
     1695            mr_asprintf(tmp, "which %s > /dev/null 2> /dev/null", executable);
    16961696            res = run_program_and_log_output(tmp, FALSE);
    16971697            mr_free(tmp);
     
    17021702            }
    17031703            tmp = executable;
    1704             mr_asprintf(&executable, "-P %s -Z", tmp);
     1704            mr_asprintf(executable, "-P %s -Z", tmp);
    17051705            mr_free(tmp);
    17061706        }
     
    17121712
    17131713        if (use_star) {
    1714             mr_asprintf(&command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
     1714            mr_asprintf(command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
    17151715            if (strstr(tarball_fname, ".bz2")) {
    17161716                mr_strcat(command, " -bz");
     
    17211721            } else {
    17221722                if (filelist_subset_fname != NULL) {
    1723                     mr_asprintf(&command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);
     1723                    mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);
    17241724                } else {
    1725                     mr_asprintf(&command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
     1725                    mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
    17261726                }
    17271727            }
     
    17301730
    17311731#undef BUFSIZE
    1732         mr_asprintf(&temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));
     1732        mr_asprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));
    17331733
    17341734        mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log);
     
    17761776        }
    17771777        if (retval) {
    1778             mr_asprintf(&command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
     1778            mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
    17791779            system(command);
    17801780            paranoid_free(command);
     
    18651865   * in afio or someting; oh darn.. OK, use tmpfs :-)                         *
    18661866   ****************************************************************************/
    1867     mr_asprintf(&afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);
    1868     mr_asprintf(&filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);
    1869     mr_asprintf(&filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);
     1867    mr_asprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);
     1868    mr_asprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);
     1869    mr_asprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);
    18701870
    18711871    res = read_file_from_stream_to_file(afio_fname, size);
     
    18771877    }
    18781878    if (bkpinfo->compression_level == 0) {
    1879         mr_asprintf(&executable, "%s", "");
     1879        mr_asprintf(executable, "%s", "");
    18801880    } else {
    18811881        if (bkpinfo->use_star) {
    1882             mr_asprintf(&executable, "%s", " -bz");
     1882            mr_asprintf(executable, "%s", " -bz");
    18831883        } else {
    1884             mr_asprintf(&executable, "-P %s -Z", bkpinfo->zip_exe);
     1884            mr_asprintf(executable, "-P %s -Z", bkpinfo->zip_exe);
    18851885        }
    18861886    }
     
    18931893        if (strstr(tarball_fname, ".star.")) {
    18941894            use_star = TRUE;
    1895             mr_asprintf(&command, "star -t file=%s %s", afio_fname, executable);
     1895            mr_asprintf(command, "star -t file=%s %s", afio_fname, executable);
    18961896        } else {
    18971897            use_star = FALSE;
    1898             mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);
     1898            mr_asprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);
    18991899        }
    19001900        mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE);
     
    19271927    if (strstr(tarball_fname, ".star.")) {
    19281928        // star
    1929         mr_asprintf(&command, "star -x file=%s %s", afio_fname, executable);
     1929        mr_asprintf(command, "star -x file=%s %s", afio_fname, executable);
    19301930        if (filelist) {
    19311931            mr_strcat(command, " list=%s", filelist_subset_fname);
     
    19331933    } else {
    19341934        // afio
    1935         mr_asprintf(&command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);
     1935        mr_asprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);
    19361936        if (filelist) {
    19371937            mr_strcat(command, " -w %s", filelist_subset_fname);
     
    20262026    assert(bkpinfo != NULL);
    20272027
    2028     mr_asprintf(&biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
     2028    mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
    20292029    if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) {
    20302030        log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set);
     
    20332033    read_cfg_var(g_mondo_cfg_file, "total-slices", tmp);
    20342034    total_slices = atol(tmp);
    2035     mr_asprintf(&tmp1, "Reassembling large files      ");
     2035    mr_asprintf(tmp1, "Reassembling large files      ");
    20362036    mvaddstr_and_log_it(g_currentY, 0, tmp1);
    20372037    mr_free(tmp1);
     
    20662066            } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
    20672067                insist_on_this_cd_number(++g_current_media_number);
    2068                 mr_asprintf(&tmp1, "Restoring from %s #%d", mds, g_current_media_number);
     2068                mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number);
    20692069                log_to_screen(tmp1);
    20702070                mr_free(tmp1);
     
    20812081        } else {
    20822082            just_changed_cds = FALSE;
    2083             mr_asprintf(&tmp1, "Restoring big file %ld", bigfileno + 1);
     2083            mr_asprintf(tmp1, "Restoring big file %ld", bigfileno + 1);
    20842084            update_progress_form(tmp1);
    20852085            mr_free(tmp1);
     
    20982098        fclose(fbw);
    20992099        if (g_getfattr) {
    2100             mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
     2100            mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
    21012101            if (length_of_file(xattr_fname) > 0) {
    21022102                set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname);
     
    21052105        }
    21062106        if (g_getfacl) {
    2107             mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
     2107            mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
    21082108            if (length_of_file(acl_fname) > 0) {
    21092109                set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname);
     
    21772177
    21782178    mds = media_descriptor_string(bkpinfo->backup_media_type);
    2179     mr_asprintf(&progress_str, "Restoring from %s #%d", mds, g_current_media_number);
     2179    mr_asprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number);
    21802180
    21812181    log_to_screen(progress_str);
     
    21892189        mr_free(progress_str);
    21902190
    2191         mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);
     2191        mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);
    21922192        if (!does_file_exist(tarball_fname)) {
    21932193            mr_free(tarball_fname);
    2194             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);
     2194            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);
    21952195        }
    21962196        if (!does_file_exist(tarball_fname)) {
    21972197            mr_free(tarball_fname);
    2198             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);
     2198            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);
    21992199        }
    22002200        if (!does_file_exist(tarball_fname)) {
    22012201            mr_free(tarball_fname);
    2202             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);
     2202            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);
    22032203        }
    22042204        if (!does_file_exist(tarball_fname)) {
    22052205            mr_free(tarball_fname);
    2206             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);
     2206            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);
    22072207        }
    22082208        if (!does_file_exist(tarball_fname)) {
    22092209            mr_free(tarball_fname);
    2210             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);
     2210            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);
    22112211        }
    22122212        if (!does_file_exist(tarball_fname)) {
     
    22242224            }
    22252225            g_current_media_number++;
    2226             mr_asprintf(&progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);
     2226            mr_asprintf(progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);
    22272227            log_to_screen(progress_str);
    22282228        } else {
    2229             mr_asprintf(&progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);
     2229            mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);
    22302230            for (res = 999, attempts = 0; attempts < 3 && res != 0;
    22312231                 attempts++) {
     
    22352235                                              filelist);
    22362236            }
    2237             mr_asprintf(&tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);
     2237            mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);
    22382238            if (res) {
    22392239                mr_strcat(tmp1, "reported errors");
     
    23192319    total_slices = atol(tmp);
    23202320    if (g_getfattr) {
    2321         mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2321        mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    23222322    }
    23232323    if (g_getfacl) {
    2324         mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    2325     }
    2326     mr_asprintf(&tmp1, "Reassembling large files      ");
     2324        mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2325    }
     2326    mr_asprintf(tmp1, "Reassembling large files      ");
    23272327    mvaddstr_and_log_it(g_currentY, 0, tmp1);
    23282328    mr_free(tmp1);
    23292329
    2330     mr_asprintf(&biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
     2330    mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
    23312331    if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) {
    23322332        log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set);
     
    23642364            p++;
    23652365        }
    2366         mr_asprintf(&tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);
     2366        mr_asprintf(tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);
    23672367        update_progress_form(tmp1);
    23682368        mr_free(tmp1);
     
    24792479    run_program_and_log_output("pwd", 5);
    24802480
    2481     mr_asprintf(&progress_str, "Restoring from media #%d", g_current_media_number);
     2481    mr_asprintf(progress_str, "Restoring from media #%d", g_current_media_number);
    24822482    log_to_screen(progress_str);
    24832483    open_progress_form("Restoring from archives",
     
    25012501        update_progress_form(progress_str);
    25022502        if (g_getfattr) {
    2503             mr_asprintf(&xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
     2503            mr_asprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
    25042504            unlink(xattr_fname);
    25052505        }
    25062506        if (g_getfacl) {
    2507             mr_asprintf(&acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
     2507            mr_asprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
    25082508            unlink(acl_fname);
    25092509        }
     
    25192519        retval += res;
    25202520        if (res) {
    2521             mr_asprintf(&tmp, "Fileset %ld - errors occurred", current_afioball_number);
     2521            mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number);
    25222522            log_to_screen(tmp);
    25232523            mr_free(tmp);
     
    25342534
    25352535        mr_free(progress_str);
    2536         mr_asprintf(&progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);
     2536        mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);
    25372537        mr_free(mds);
    25382538        res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr);
     
    25942594    g_current_media_number = 1;
    25952595    getcwd(cwd, MAX_STR_LEN - 1);
    2596     mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->restore_path);
     2596    mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path);
    25972597    run_program_and_log_output(tmp, FALSE);
    25982598    mr_free(tmp);
     
    26662666{
    26672667    log_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION);
    2668     log_msg(0,
    2669             "DON'T PANIC! Mondorestore logs almost everything, so please ");
    2670     log_msg(0,
    2671             "don't break out in a cold sweat just because you see a few  ");
    2672     log_msg(0,
    2673             "error messages in the log. Read them; analyze them; see if  ");
    2674     log_msg(0,
    2675             "they are significant; above all, verify your backups! Please");
    2676     log_msg(0,
    2677             "attach a compressed copy of this log to any e-mail you send ");
    2678     log_msg(0,
    2679             "to the Mondo mailing list when you are seeking technical    ");
    2680     log_msg(0,
    2681             "support. Without it, we can't help you.            - DevTeam");
    2682     log_msg(0,
    2683             "------------------------------------------------------------");
    2684     log_msg(0,
    2685             "BTW, despite (or perhaps because of) the wealth of messages,");
    2686     log_msg(0,
    2687             "some users are inclined to stop reading this log.  If Mondo ");
    2688     log_msg(0,
    2689             "stopped for some reason, chances are it's detailed here.    ");
    2690     log_msg(0,
    2691             "More than likely there's a message at the very end of this  ");
    2692     log_msg(0,
    2693             "log that will tell you what is wrong.  Please read it!      ");
    2694     log_msg(0,
    2695             "------------------------------------------------------------");
     2668    log_msg(0, "DON'T PANIC! Mondorestore logs almost everything, so please ");
     2669    log_msg(0, "don't break out in a cold sweat just because you see a few  ");
     2670    log_msg(0, "error messages in the log. Read them; analyze them; see if  ");
     2671    log_msg(0, "they are significant; above all, verify your backups! Please");
     2672    log_msg(0, "attach a compressed copy of this log to any e-mail you send ");
     2673    log_msg(0, "to the Mondo mailing list when you are seeking technical    ");
     2674    log_msg(0, "support. Without it, we can't help you.            - DevTeam");
     2675    log_msg(0, "------------------------------------------------------------");
     2676    log_msg(0, "BTW, despite (or perhaps because of) the wealth of messages,");
     2677    log_msg(0, "some users are inclined to stop reading this log.  If Mondo ");
     2678    log_msg(0, "stopped for some reason, chances are it's detailed here.    ");
     2679    log_msg(0, "More than likely there's a message at the very end of this  ");
     2680    log_msg(0, "log that will tell you what is wrong.  Please read it!      ");
     2681    log_msg(0, "------------------------------------------------------------");
    26962682}
    26972683
     
    27682754
    27692755    /* Backup original mountlist.txt */
    2770     mr_asprintf(&tmp, "%s.orig", g_mountlist_fname);
     2756    mr_asprintf(tmp, "%s.orig", g_mountlist_fname);
    27712757    if (!does_file_exist(g_mountlist_fname)) {
    27722758        log_msg(2, "%ld: Warning - g_mountlist_fname (%s) does not exist yet", __LINE__, g_mountlist_fname);
    27732759    } else if (!does_file_exist(tmp)) {
    27742760        mr_free(tmp);
    2775         mr_asprintf(&tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);
     2761        mr_asprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);
    27762762        run_program_and_log_output(tmp, FALSE);
    27772763    }
     
    29482934        log_msg(2, "Still here. Yay.");
    29492935        if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) {
    2950             mr_asprintf(&tmp, "rm -Rf %s/*", bkpinfo->tmpdir);
     2936            mr_asprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir);
    29512937            run_program_and_log_output(tmp, FALSE);
    29522938            mr_free(tmp);
     
    29712957                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
    29722958                log_msg(1, "Mounting nfs dir");
    2973                 sprintf(bkpinfo->isodir, "/tmp/isodir");
     2959                mr_free(bkpinfo->isodir);
     2960                mr_asprintf(tmp, "/tmp/isodir");
     2961                bkpinfo->isodir = tmp;
    29742962                run_program_and_log_output("mkdir -p /tmp/isodir", 5);
    2975                 mr_asprintf(&tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);
     2963                mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);
    29762964                run_program_and_log_output(tmp, 1);
    29772965                mr_free(tmp);
     
    30703058      } else {
    30713059        log_msg(1, "Re-mounted partitions for post-nuke stuff");
    3072         mr_asprintf(&tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);
     3060        mr_asprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);
    30733061        log_msg(2, "Calling '%s'", tmp);
    30743062        if ((res = run_program_and_log_output(tmp, 0))) {
     
    30913079    set_signals(FALSE);
    30923080    log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE);
    3093     mr_asprintf(&tmp, "Mondo-restore is exiting (retval=%d)                                      ", retval);
     3081    mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d)                                      ", retval);
    30943082    log_to_screen(tmp);
    30953083    mr_free(tmp);
    30963084
    3097     mr_asprintf(&tmp, "umount %s", bkpinfo->isodir);
     3085    mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
    30983086    run_program_and_log_output(tmp, 5);
    30993087    mr_free(tmp);
     
    31053093    }                           // for b0rken distros
    31063094    if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) {
    3107         mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir);
     3095        mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
    31083096        system(tmp);
    31093097        mr_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.