Changeset 688 in MondoRescue for trunk/mondo/mondo/common/libmondo-fifo.c


Ignore:
Timestamp:
Jul 17, 2006, 3:44:46 PM (18 years ago)
Author:
bcornec
Message:

Huge memory management patch.
Still not finished but a lot as been done.
What remains is around some functions returning strings, and some structure members.
(Could not finish due to laptop failure !)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-fifo.c

    r687 r688  
    1313#endif
    1414#include <fcntl.h>
    15 #include <stdio.h>
    1615
    1716#include <errno.h>
     
    8584    wise_upper_limit = (am_I_in_disaster_recovery_mode()? 8 : 32);
    8685    wise_lower_limit = 1;       // wise_upper_limit/2 + 1;
    87     paranoid_system("sync");
     86    sync();
    8887    for (bufsize = wise_upper_limit, res = -1;
    8988         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
     
    9695    if (!res) {
    9796        bufsize++;
    98         asprintf(&tmp, _("Negotiated max buffer of %d MB ", bufsize));
     97        asprintf(&tmp, _("Negotiated max buffer of %d MB "), bufsize);
    9998        log_to_screen(tmp);
    10099        paranoid_free(tmp);
     
    160159    char *command;
    161160
    162     paranoid_system("sync");
     161    sync();
    163162    asprintf(&command,
    164163            "ps wwax | grep -F \"%s\" | grep -Fv grep | awk '{print $1;}' | grep -v PID | tr -s '\n' ' ' | awk '{ print $1; }'",
     
    167166    log_msg(2, "kill_buffer() --- command = %s", command);
    168167
    169     asprintf(&tmp, "%s",
    170              call_program_and_get_last_line_of_output(command));
     168    tmp = call_program_and_get_last_line_of_output(command);
    171169    paranoid_free(command);
    172170
     
    177175        run_program_and_log_output(command, TRUE);
    178176    }
     177    paranoid_free(tmp);
    179178    paranoid_free(command);
    180     paranoid_free(tmp);
    181179}
    182180
Note: See TracChangeset for help on using the changeset viewer.