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

r3342@localhost: bruno | 2009-08-14 00:46:51 +0200

  • Another round of strcpy suppressions
  • find_home_of_exe() now allocates memory which has to be freed by the caller
  • Supress useless sz_last_suffix()
  • mr_getline now has the same interface as the other mr_mem functions
  • valgrind and compiler warnings fixes
File:
1 edited

Legend:

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

    r2325 r2331  
    589589// BACKUP
    590590    int res = -1;
    591     char*command = NULL;
     591    char *command = NULL;
    592592
    593593    if (!does_file_exist(input_device)) {
    594594        fatal_error("input device does not exist");
    595595    }
    596     if ( !find_home_of_exe("ntfsclone")) {
     596    command = find_home_of_exe("ntfsclone");
     597    if (!command) {
     598        mr_free(command);
    597599        fatal_error("ntfsclone not found");
    598600    }
     601    mr_free(command);
     602
    599603    mr_asprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
    600604    res = run_program_and_log_output(command, 5);
     
    639643    /*@ buffers *********************************************************** */
    640644    char *command = NULL;
    641     char *title;
     645    char *title = NULL;
    642646    /*@ pointers ********************************************************** */
    643647    static int chldres = 0;
     
    650654    *pchild_result = 999;
    651655
    652     malloc_string(title);
    653     strcpy(title, tt);
    654656    mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);
    655657    log_msg(3, "command = '%s'", command);
     
    659661
    660662    log_msg(8, "Parent running");
     663    mr_asprintf(title, "%s", tt);
    661664    open_evalcall_form(title);
     665    mr_free(title);
     666
    662667    for (sleep(1); command[0] != '\0'; sleep(1)) {
    663668        pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
     
    669674        if (pcno <= 5 && last_pcno >= 40) {
    670675            close_evalcall_form();
    671             strcpy(title, "Verifying...");
     676            mr_asprintf(title, "Verifying...");
    672677            open_evalcall_form(title);
     678            mr_free(title);
    673679        }
    674680        if (counter++ >= 5) {
     
    690696    }
    691697    log_msg(3, "Parent res = %d", res);
    692     paranoid_free(title);
    693698    return (res);
    694699}
    695 
    696 
    697700
    698701
     
    709712    char *command = NULL;
    710713
    711     if ( !find_home_of_exe("ntfsclone")) {
     714    command = find_home_of_exe("ntfsclone");
     715    if (!command) {
     716        mr_free(command);
    712717        fatal_error("ntfsclone not found");
    713718    }
     719    mr_free(command);
     720
    714721    mr_asprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
    715722    res = run_program_and_log_output(command, 5);
Note: See TracChangeset for help on using the changeset viewer.