Ignore:
Timestamp:
Aug 18, 2009, 2:37:39 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3331@localhost: bruno | 2009-08-06 01:34:32 +0200

  • bkpinfo->scratchdir is now dynamically allocated
  • mondoarchive tests made in text+newt env. Seems OK. Valgrind errors to be fixed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2319 r2320  
    294294     fatal_error(char *error_string) {
    295295        /*@ buffers ***************************************************** */
    296         char fatalstr[MAX_NEWT_COMMENT_LEN] =
    297             "-------FATAL ERROR---------";
    298         char *tmp;
    299         char *command;
     296        char *command = NULL;
    300297        static bool already_exiting = FALSE;
    301298
    302299        /*@ end vars **************************************************** */
    303300
    304         malloc_string(command);
    305         tmp = malloc(MAX_NEWT_COMMENT_LEN);
    306301        set_signals(FALSE);     // link to external func
    307302        g_exiting = TRUE;
     
    311306            log_msg(2, "mastermind %d is exiting", (int) getpid());
    312307            kill(g_main_pid, SIGTERM);
    313             paranoid_free(tmp);
    314308            finish(1);
    315309        }
     
    319313                log_msg(2, "non-m/m %d is exiting", (int) getpid());
    320314                kill(g_main_pid, SIGTERM);
    321                 paranoid_free(tmp);
    322315                finish(1);
    323316            }
     
    327320        if (already_exiting) {
    328321            log_msg(3, "...I'm already exiting. Give me time, Julian!");
    329             paranoid_free(tmp);
    330322            finish(1);
    331323        }
     
    338330        kill_anything_like_this("ntfsclone");
    339331        sync();
    340         /*
    341         sprintf(tmp, "umount %s", g_tmpfs_mountpt);
    342         for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) {
    343             log_msg(2, "Waiting for child processes to terminate");
    344             sleep(1);
    345             run_program_and_log_output(tmp, 5);
    346         }
    347         */
    348332
    349333        chdir("/");
    350334        if (g_selfmounted_isodir) {
    351             sprintf(command, "umount %s", g_selfmounted_isodir);
     335            mr_asprintf(&command, "umount %s", g_selfmounted_isodir);
    352336            run_program_and_log_output(command, 5);
    353             sprintf(command, "rmdir %s", g_selfmounted_isodir);
     337            mr_free(command);
     338            mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
    354339            run_program_and_log_output(command, 5);
     340            mr_free(command);
    355341        }
    356342
    357343        if (!g_text_mode) {
    358             log_msg(0, fatalstr);
     344            log_msg(0, "-------FATAL ERROR---------");
    359345            log_msg(0, error_string);
    360346            newtFinished();
     
    362348
    363349        printf("---FATALERROR--- %s\n", error_string);
    364         printf
    365                 ("If you require technical support, please contact the mailing list.\n");
     350        printf("If you require technical support, please contact the mailing list.\n");
    366351        printf("See http://www.mondorescue.org for details.\n");
    367         printf
    368                 ("The list's members can help you, if you attach that file to your e-mail.\n");
     352        printf("The list's members can help you, if you attach that file to your e-mail.\n");
    369353        printf("Log file: %s\n", MONDO_LOGFILE);
    370354        printf("Mondo has aborted.\n");
     
    372356            log_msg(3, "FYI - g_main_pid is blank");
    373357        }
    374         paranoid_free(tmp);
    375         paranoid_free(command);
    376358        finish(254);
    377359    }
     
    405387            mr_asprintf(&command, "umount %s", g_selfmounted_isodir);
    406388            run_program_and_log_output(command, 1);
    407             paranoid_free(command);
     389            mr_free(command);
     390
    408391            mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
    409392            run_program_and_log_output(command, 1);
    410             paranoid_free(command);
     393            mr_free(command);
    411394        }
    412395        if (!g_text_mode) {
     
    443426        mr_free(bkpinfo->exclude_paths);
    444427        mr_free(bkpinfo->include_paths);
     428        mr_free(bkpinfo->scratchdir);
    445429
    446430        /* Then free the structure */
    447         paranoid_free(bkpinfo);
     431        mr_free(bkpinfo);
    448432        free_libmondo_global_strings();
    449433        free_newt_stuff();
     
    947931        }
    948932
    949         err_log_lines =
    950             (char **) malloc(sizeof(char *) * g_noof_log_lines);
    951         if (!err_log_lines) {
    952             fatal_error("Out of memory");
    953         }
     933        err_log_lines = (char **) mr_malloc(sizeof(char *) * g_noof_log_lines);
    954934
    955935        for (i = 0; i < g_noof_log_lines; i++) {
    956             err_log_lines[i] = (char *) malloc(MAX_NEWT_COMMENT_LEN);
    957             if (!err_log_lines[i]) {
    958                 fatal_error("Out of memory");
    959             }
     936            err_log_lines[i] = (char *) mr_malloc(MAX_NEWT_COMMENT_LEN);
    960937        }
    961938
     
    10551032        }
    10561033        if (!g_text_mode) {
    1057 //      log_it("refreshing");
    10581034            newtRefresh();
    10591035        }
     
    10801056    void
    10811057     update_progress_form(char *blurb3) {
    1082         /*  log_it("update_progress_form --- called"); */
    10831058        if (g_current_progress == -999) {
    1084             /* log_it("You're trying to update progress form when it ain't open. Aww, that's OK. I'll let it go. It's a bit naughty but it's a nonfatal error. No prob, Bob."); */
    10851059            return;
    10861060        }
     
    11941168        }
    11951169    }
    1196 
    1197 
    1198 
    1199 
    1200 
    1201 
    1202 
    1203 
    1204 
    1205 
    1206 
    1207 
    12081170
    12091171
     
    12801242        }
    12811243        newtPushHelpLine(title_sz);
    1282         //  newtOpenWindow (23, 3, 34, 17, minimsg_sz);
    12831244        newtCenteredWindow(34, 17, minimsg_sz);
    12841245        b1 = newtButton(1, 1, "CD-R disks ");
Note: See TracChangeset for help on using the changeset viewer.