Changeset 3615 in MondoRescue


Ignore:
Timestamp:
Nov 18, 2016, 5:31:43 PM (7 years ago)
Author:
Bruno Cornec
Message:

Fix call_program_and_get_last_line_of_output which was aborting due to an
excessive loop call

Location:
branches/3.2/mondo/src
Files:
3 edited

Legend:

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

    r3610 r3615  
    3838 * caller
    3939 */
    40 char *call_program_and_get_last_line_of_output(char *call)
    41 {
     40char *call_program_and_get_last_line_of_output(const char *call) {
    4241    /*@ buffers ***************************************************** */
    4342    char *result = NULL;
    44     char *tmp = NULL;
     43    char *resultbkp = NULL;
     44    char *result2 = NULL;
    4545
    4646    /*@ pointers **************************************************** */
     
    5959            if (strlen(result) > 1) {
    6060                log_msg(7, "result = '%s'", result);
     61                /* in case we have to loop, we keep the
     62                 * previous value */
     63                mr_free(resultbkp);
     64                mr_asprintf(resultbkp, "%s", result);
     65            } else {
     66                /* we had to loop and got nothing useul, so we keep the
     67                 * previous value */
     68                mr_free(result);
     69                result = resultbkp;
    6170            }
    6271        }
     
    6675    }
    6776    mr_free(eng_call);
    68     mr_strip_spaces(result);
    69     log_msg(5, "cpaglloo returns '%s'", result);
    70     return(result);
     77    if (result != NULL) {
     78        result2 = mr_strip_spaces(result);
     79        mr_free(result);
     80        log_msg(5, "cpaglloo returns '%s'", result2);
     81    } else {
     82        mr_asprintf(result2, "");
     83    }
     84    return(result2);
    7185}
    7286
  • branches/3.2/mondo/src/common/libmondo-fork.h

    r1999 r3615  
    55
    66
    7 char *call_program_and_get_last_line_of_output(char *call);
     7char *call_program_and_get_last_line_of_output(const char *call);
    88int run_program_and_log_to_screen(char *basic_call, char *what_i_am_doing);
    99int run_program_and_log_output(char *program, int);
  • branches/3.2/mondo/src/mondorestore/mr-externs.h

    r3273 r3615  
    2121extern int closein_tape();
    2222extern void close_evalcall_form(void);
    23 extern char *call_program_and_get_last_line_of_output(char *);
     23extern char *call_program_and_get_last_line_of_output(const char *);
    2424extern void close_progress_form(void);
    2525extern long count_lines_in_file(char *);
Note: See TracChangeset for help on using the changeset viewer.