Changeset 2277


Ignore:
Timestamp:
Jul 13, 2009, 2:34:39 AM (10 years ago)
Author:
bruno
Message:

r3263@localhost: bruno | 2009-07-13 02:25:52 +0200

  • Fix printing bug in text mode during afio backup
  • Fix a wrong tmp usage after mr_asprintf migration in libmondo-archive.c
Location:
branches/2.2.10/mondo/src/common
Files:
2 edited

Legend:

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

    r2267 r2277  
    10341034    bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET);
    10351035
    1036     sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
    1037             bkpinfo->tmpdir, 0L);
     1036    sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, 0L);
    10381037    for (archiving_set_no = 0; does_file_exist(archiving_filelist_fname);
    1039          sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
    1040                  bkpinfo->tmpdir, archiving_set_no)) {
     1038         sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no)) {
    10411039        if (g_exiting) {
    10421040            fatal_error("Execution run aborted (pthread)");
    10431041        }
    10441042        if (archiving_set_no >= MAX_NOOF_SETS_HERE) {
    1045             fatal_error
    1046                 ("Maximum number of filesets exceeded. Adjust MAX_NOOF_SETS_HERE, please.");
     1043            fatal_error("Maximum number of filesets exceeded. Adjust MAX_NOOF_SETS_HERE, please.");
    10471044        }
    10481045        if (!semaphore_p()) {
     
    10591056
    10601057        /* backup this set of files */
    1061         sprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ,
    1062                 bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix);
    1063         sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
    1064                 bkpinfo->tmpdir, archiving_set_no);
     1058        sprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix);
     1059        sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    10651060        if (!does_file_exist(archiving_filelist_fname)) {
    10661061            log_msg(3,
     
    10711066        }
    10721067
    1073         mr_asprintf(&tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir,
    1074                 archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
     1068        mr_asprintf(&tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
    10751069        if (does_file_exist(tmp)) {
    10761070            log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES,
     
    34273421            mr_asprintf(&tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
    34283422            mr_free(mds);
    3429             res = ask_me_yes_or_no(tmp);
     3423            res = ask_me_yes_or_no(tmp1);
    34303424            mr_free(tmp1);
    34313425
     
    34653459
    34663460    bkpinfo->verify_data = orig_vfy_flag_val;
     3461    mr_free(tmp);
    34673462    return (0);
    34683463}
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2274 r2277  
    9696    long g_maximum_progress = 999;  ///< The maximum amount of progress (100%) for the currently opened progress form.
    9797    long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form.
    98     long g_start_time = 0;      ///< The time (in seconds since the epoch) that the progress form was opened.
     98    long g_start_time = 0L;     ///< The time (in seconds since the epoch) that the progress form was opened.
    9999    bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
    100100    char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN],  ///< ... @bug Unneeded w/current XMondo.
     
    979979
    980980        /*@ long ************************************************************ */
    981         long current_time = 0;
    982         long time_taken = 0;
    983         long time_total_est = 0;
    984         long time_remaining = 0;
     981        long current_time = 0L;
     982        long time_taken = 0L;
     983        long time_total_est = 0L;
     984        long time_remaining = 0L;
    985985
    986986        /*@ buffers ********************************************************** */
     
    10061006            time_remaining = time_total_est - time_taken;
    10071007        } else {
    1008             time_remaining = 0;
     1008            time_remaining = 0L;
    10091009        }
    10101010        if (!g_text_mode) {
     
    10171017            || percentage > g_isoform_old_progress) {
    10181018            g_isoform_old_progress = percentage;
    1019             mr_asprintf(&timeline_str,
    1020                     "%2ld:%02ld taken            %2ld:%02ld remaining",
    1021                     time_taken / 60, time_taken % 60, time_remaining / 60,
    1022                     time_remaining % 60);
     1019            mr_asprintf(&timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60,
     1020                            (long) time_remaining / 60, (long) time_remaining % 60);
    10231021            if (percentage < 3) {
    10241022                mr_asprintf(&pcline_str, " Working");
     
    10431041                }
    10441042                if (percentage >= 3) {
    1045                     mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage,
    1046                             time_remaining / 60, time_remaining % 60);
    1047                     printf("---evalcall---1--- %s\n",
    1048                            g_isoform_header_str);
     1043                    mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, time_remaining / 60, time_remaining % 60);
     1044                    printf("---evalcall---1--- %s\n", g_isoform_header_str);
    10491045                    printf("---evalcall---2--- %s\n", taskprogress);
    10501046                    printf("---evalcall---E---\n");
    10511047                }
    1052                 paranoid_free(taskprogress);
     1048                mr_free(taskprogress);
    10531049            } else {
    10541050                newtScaleSet(g_isoform_scale,
     
    11101106     update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) {
    11111107        /*@ long ***************************************************** */
    1112         long current_time = 0;
    1113         long time_taken = 0;
    1114         long time_remaining = 0;
    1115         long time_total_est = 0;
     1108        long current_time = 0L;
     1109        long time_taken = 0L;
     1110        long time_remaining = 0L;
     1111        long time_total_est = 0L;
    11161112
    11171113        /*@ int ******************************************************* */
     
    11461142                g_current_progress = g_maximum_progress;
    11471143            }
    1148             percentage =
    1149                 (int) ((g_current_progress * 100L) / g_maximum_progress);
     1144            percentage = (int) ((g_current_progress * 100L) / g_maximum_progress);
    11501145        }
    11511146        if (percentage < 1) {
     
    11561151        }
    11571152        if (g_current_progress) {
    1158             time_total_est =
    1159                 time_taken * (long) g_maximum_progress /
    1160                 (long) (g_current_progress);
     1153            time_total_est = time_taken * (long) g_maximum_progress / (long) g_current_progress;
    11611154            time_remaining = time_total_est - time_taken;
    11621155        } else {
    1163             time_remaining = 0;
     1156            time_remaining = 0L;
    11641157        }
    11651158        g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
     
    11791172                log_msg(2, "percentage = %d", percentage);
    11801173            }
    1181             mr_strcat(taskprogress, "] %3d%c", percentage, '%');
    1182             mr_strcat(taskprogress, " done; %2ld:%02ld to go",
    1183                     time_remaining / 60, time_remaining % 60);
     1174            mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);
    11841175            printf("---progress-form---4--- %s\n", taskprogress);
    11851176            paranoid_free(taskprogress);
    11861177        } else {
    1187             mr_asprintf(&timeline_str,
    1188                 "%2ld:%02ld taken               %2ld:%02ld remaining  ",
    1189                 time_taken / 60, time_taken % 60, time_remaining / 60,
    1190                 time_remaining % 60);
    1191             mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go",
    1192                 percentage, 100 - percentage);
     1178            mr_asprintf(&timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ",
     1179                (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     1180            mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
    11931181
    11941182            center_string(blurb1, 54);
Note: See TracChangeset for help on using the changeset viewer.