Changeset 1176 in MondoRescue for trunk/mondo/src/common/libmondo-fork.c


Ignore:
Timestamp:
Feb 16, 2007, 2:16:14 PM (17 years ago)
Author:
Bruno Cornec
Message:

Some merges from stable (synchro for mem. mngt)

File:
1 edited

Legend:

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

    r1161 r1176  
    44#include "my-stuff.h"
    55#include "mr_mem.h"
     6#include "mr_msg.h"
     7#include "mr_str.h"
     8
    69#include "mondostructures.h"
    710#include "libmondo-fork.h"
     
    1013#include "libmondo-files-EXT.h"
    1114#include "libmondo-tools-EXT.h"
    12 #include "mr_mem.h"
    1315
    1416extern bool g_text_mode;
     
    164166
    165167    /*@ pointers *************************************************** */
    166     FILE *fin;
    167     char *p;
     168    FILE *fin = NULL;
     169    char *p = NULL;
    168170
    169171    /*@ end vars *************************************************** */
     
    188190        *p = ' ';
    189191    }                           /* single '=' is intentional */
    190 
    191192
    192193    res = system(callstr);
     
    208209    fin = fopen("/tmp/mondo-run-prog-thing.tmp", "r");
    209210    if (fin) {
    210         for (mr_getline(&incoming, &n, fin); !feof(fin);
    211              mr_getline(&incoming, &n, fin)) {
     211        for (mr_getline(&incoming, &n, fin); !feof(fin); mr_getline(&incoming, &n, fin)) {
    212212            /* patch by Heiko Schlittermann */
    213213            p = incoming;
     
    219219            }
    220220            /* end of patch */
    221             strip_spaces(incoming);
     221            mr_strip_spaces(incoming);
    222222            if ((res == 0 && log_if_success)
    223223                || (res != 0 && log_if_failure)) {
     
    238238        }
    239239    }
    240 //  else
    241 //    { mr_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); }
    242240    return (res);
    243241}
     
    339337// if dir=='r' then copy from archived to orig
    340338    char *tmp = NULL;
     339    char *tmp1 = NULL;
    341340    char *buf = NULL;
    342341    long int bytes_to_be_read, bytes_read_in, bytes_written_out =
     
    354353        fin = f_orig;
    355354        fout = f_archived;
    356         mr_asprintf(&tmp, "%-64s", PIMP_START_SZ);
    357         if (fwrite(tmp, 1, 64, fout) != 64) {
     355        mr_asprintf(&tmp1, "%-64s", PIMP_START_SZ);
     356        if (fwrite(tmp1, 1, 64, fout) != 64) {
    358357            fatal_error("Can't write the introductory block");
    359358        }
    360         mr_free(tmp);
     359        mr_free(tmp1);
    361360
    362361        while (1) {
     
    365364                break;
    366365            }
    367             mr_asprintf(&tmp, "%-64ld", bytes_read_in);
    368             if (fwrite(tmp, 1, 64, fout) != 64) {
     366            mr_asprintf(&tmp1, "%-64ld", bytes_read_in);
     367            if (fwrite(tmp1, 1, 64, fout) != 64) {
    369368                fatal_error("Cannot write introductory block");
    370369            }
    371             mr_free(tmp);
     370            mr_free(tmp1);
    372371
    373372            mr_msg(7,
     
    375374                    subsliceno, bytes_read_in, bytes_to_be_read);
    376375            bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
    377             mr_asprintf(&tmp, "%-64ld", subsliceno);
    378             if (fwrite(tmp, 1, 64, fout) != 64) {
     376            mr_asprintf(&tmp1, "%-64ld", subsliceno);
     377            if (fwrite(tmp1, 1, 64, fout) != 64) {
    379378                fatal_error("Cannot write post-thingy block");
    380379            }
    381             mr_free(tmp);
     380            mr_free(tmp1);
    382381
    383382            mr_msg(7, "Subslice #%d written OK", subsliceno);
     
    391390        fin = f_archived;
    392391        fout = f_orig;
    393         if (!(tmp = malloc(64L))) {
    394             fatal_error("Failed to malloc() tmp");
    395         }
     392        tmp = mr_malloc(64L);
    396393        if (fread(tmp, 1, 64L, fin) != 64L) {
    397394            fatal_error("Cannot read the introductory block");
     
    433430
    434431    if (direction == 'w') {
    435         mr_free(tmp);
    436         mr_asprintf(&tmp, "%-64s", PIMP_END_SZ);
    437         if (fwrite(tmp, 1, 64L, fout) != 64L) {
     432        mr_asprintf(&tmp1, "%-64s", PIMP_END_SZ);
     433        if (fwrite(tmp1, 1, 64L, fout) != 64L) {
    438434            fatal_error("Can't write the final block");
    439435        }
    440         mr_free(tmp);
     436        mr_free(tmp1);
    441437    } else {
    442438        mr_msg(1, "tmpA is %s", tmp);
     
    468464            }
    469465        }
    470         mr_free(tmp);
    471466    }
    472467
    473468    mr_free(buf);
     469    mr_free(tmp);
    474470    mr_msg(3, "Successfully copied %ld bytes", bytes_written_out);
    475471    return (retval);
Note: See TracChangeset for help on using the changeset viewer.