Changeset 3840 in MondoRescue


Ignore:
Timestamp:
Mar 6, 2024, 1:20:15 AM (3 months ago)
Author:
Bruno Cornec
Message:

Fix a static memory allocation in fifo mngt

Location:
branches/3.3/mondo/src/common
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/Makefile.am

    r3564 r3840  
    1717                       libmondo-gui.h libmondo-raid.h \
    1818                       libmondo-stream.h libmondo-string.h libmondo-tools.h \
    19                        libmondo-verify.h libmondo-fifo.h libmondo-cli.h \
     19                       libmondo-verify.h libmondo-cli.h \
    2020                       libmondo-archive-EXT.h my-stuff.h mondostructures.h \
    2121                       libmondo-devices-EXT.h libmondo-fifo-EXT.h \
  • branches/3.3/mondo/src/common/libmondo-fifo.c

    r3610 r3840  
    4040
    4141
    42 
    4342/**
    4443 * Command line with which @c buffer was invoked.
    4544 */
    46 char g_sz_call_to_buffer[MAX_STR_LEN];
     45char *g_call_to_buffer = NULL;
    4746
    4847/**
     
    107106    }
    108107    if (bufsize) {
    109         sprintf(g_sz_call_to_buffer,
     108        mr_asprintf(g_call_to_buffer,
    110109                "buffer -m %d%c -p%d -B -s%ld -%c %s 2>> %s", bufsize, 'm',
    111110                (direction == 'r') ? 20 : 75, internal_tape_block_size,
    112111                keych, device, MONDO_LOGFILE);
    113112    } else {
    114         sprintf(g_sz_call_to_buffer, "dd bs=%ld %cf=%s",
     113        mr_asprintf(g_call_to_buffer, "dd bs=%ld %cf=%s",
    115114                internal_tape_block_size, keych, device);
    116115    }
    117     log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer);
     116    log_msg(2, "Calling buffer --- command = '%s'", g_call_to_buffer);
    118117    mr_asprintf(sz_dir, "%c", direction);
    119     fres = popen(g_sz_call_to_buffer, sz_dir);
     118    fres = popen(g_call_to_buffer, sz_dir);
    120119    mr_free(sz_dir);
    121120
     
    128127    }
    129128    sleep(2);
    130     mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
     129    mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_call_to_buffer);
    131130    if (run_program_and_log_output(tmp, 2)) {
    132131        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    149148/**
    150149 * Kill @c buffer processes.
    151  * Only called in mondoarchive
     150 * Only called in mondoarchive at then before exiting thus freeing memory
    152151 */
    153152void kill_buffer()
     
    156155    char *command = NULL;
    157156
    158     if (g_sz_call_to_buffer == NULL) {
     157    if (g_call_to_buffer == NULL) {
    159158        return;
    160159    }
    161     if (strcmp(g_sz_call_to_buffer,"") == 0) {
     160    if (strcmp(g_call_to_buffer,"") == 0) {
    162161        return;
    163162    }
    164163    sync();
    165     mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
     164    mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_call_to_buffer);
    166165    log_msg(2, "kill_buffer() --- command = %s", command);
    167166    tmp = call_program_and_get_last_line_of_output(command);
     
    175174    mr_free(tmp);
    176175    mr_free(command);
     176    mr_free(g_call_to_buffer);
    177177}
    178178
Note: See TracChangeset for help on using the changeset viewer.