Ignore:
Timestamp:
Aug 18, 2009, 3:13:54 PM (15 years ago)
Author:
Bruno Cornec
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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.