Changeset 1176 in MondoRescue


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

Some merges from stable (synchro for mem. mngt)

Location:
trunk/mondo/src/common
Files:
6 edited

Legend:

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

    r1161 r1176  
    1919#include "mr_mem.h"
    2020#include "mr_msg.h"
     21#include "mr_str.h"
    2122
    2223#include <sys/ioctl.h>
     
    4142
    4243extern bool g_ISO_restore_mode;
    43 extern struct s_bkpinfo *g_bkpinfo_DONTUSETHIS;
    4444extern char *g_erase_tmpdir_and_scratchdir;
    4545extern char *g_selfmounted_isodir;
     
    10931093
    10941094    FILE *pin = NULL;
    1095     bool retval;
     1095    bool retval = FALSE;
    10961096    size_t n = 0;
    10971097    assert_string_is_neither_NULL_nor_zerolength(format);
     
    11121112    if (!pin) {
    11131113        log_OS_error("Unable to read good formats");
    1114         retval = FALSE;
    11151114    } else {
    11161115        mr_getline(&good_formats, &n , pin);
     
    11181117            log_OS_error("Cannot pclose good formats");
    11191118        }
    1120         strip_spaces(good_formats);
     1119        mr_strip_spaces(good_formats);
    11211120        // " ntfs 7 " -- um, cheating much? :)
    11221121        mr_asprintf(&tmp, " %s swap lvm raid ntfs 7 ",good_formats);
     
    11261125        if (strstr(good_formats, format_sz)) {
    11271126            retval = TRUE;
    1128         } else {
    1129             retval = FALSE;
    11301127        }
    11311128        mr_free(good_formats);
     
    16931690            // check whether already mounted - we better remove
    16941691            // surrounding spaces and trailing '/' for this
    1695             /* BERLIOS: Useless
    1696             strip_spaces(bkpinfo->nfs_mount);
    1697             */
     1692            mr_strip_spaces(bkpinfo->nfs_mount);
    16981693            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    16991694                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
     
    22702265    for (mr_getline(&current_drive, &n, pdrives); !feof(pdrives);
    22712266         mr_getline(&current_drive, &n, pdrives)) {
    2272         strip_spaces(current_drive);
     2267        mr_strip_spaces(current_drive);
    22732268        log_it("looking at drive %s's MBR", current_drive);
    22742269        if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
  • trunk/mondo/src/common/libmondo-files.c

    r1161 r1176  
    1818#include "libmondo-fork-EXT.h"
    1919#include "libmondo-string-EXT.h"
     20
    2021#include "mr_mem.h"
    21 
     22#include "mr_msg.h"
    2223#include "mr_file.h"
    2324
     
    176177void exclude_nonexistent_files(char *inout)
    177178{
    178     char *infname;
    179     char *outfname;
    180     char *tmp;
     179    char *infname = NULL;
     180    char *outfname = NULL;
     181    char *tmp = NULL;
    181182    char *incoming = NULL;
    182183
     
    944945    /*@ Char buffers ** */
    945946    char *command = NULL;
    946     char *tmp;
     947    char *tmp = NULL;
    947948    char old_pwd[MAX_STR_LEN];
    948949
  • 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);
  • trunk/mondo/src/common/libmondo-mountlist.c

    r1161 r1176  
    22   $Id$
    33*/
     4
    45
    56/**
     
    2122/*@unused@*/
    2223//static char cvsid[] = "$Id$";
    23 
    24 /**
    25  * A global copy of @c bkpinfo, to aid in debugging. As the name implies, <em>don't use this</em>.
    26  * @ingroup globalGroup
    27  */
    28 struct s_bkpinfo *g_bkpinfo_DONTUSETHIS = NULL;
    2924
    3025/**
     
    7772    /*@ initialize ***************************************************** */
    7873    prev_part_no = 0;
    79     // BERLIOS: tmp[0] = '\0';
    8074
    8175
     
    8377
    8478    if (physical_drive_size < 0) {
    85         mr_asprintf(&tmp, " %s does not exist.", drive);
     79        mr_asprintf(&tmp, "%s %s does not exist.", flaw_str, drive);
     80        mr_free(flaw_str);
    8681        flaws_str = tmp;
    8782    } else {
     
    225220            return ++res;       // fatal error
    226221        }
     222
     223        mr_asprintf(&device, "%ss%d", drive, curr_part_no);
    227224        // BERLIOS : useless ? mr_asprintf(&mountpoint, mountlist->el[pos].mountpoint);
    228225        if (pos > 0 && !npos) {
    229             mr_asprintf(&device, "%ss%d", drive, curr_part_no);
    230226            /* gap in the partition list? */
    231227            if (curr_part_no - prev_part_no > 1) {
     
    346342                res++;
    347343            }
    348             mr_free(device);
    349344        } else {
    350345            /* Check subpartitions */
    351346            for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) {
    352                 mr_asprintf(&device, "%ss%d%c", drive, curr_part_no,
    353                          cur_sp_no);
     347                mr_asprintf(&device, "%ss%d%c", drive, curr_part_no, cur_sp_no);
    354348                pos = find_device_in_mountlist(mountlist, device);
    355349                if (pos < 0) {
     
    446440                amount_allocated += mountlist->el[pos].size / 1024;
    447441                prev_sp_no = cur_sp_no;
    448                 mr_free(device);
    449             }
    450         }
     442            }
     443        }
     444        mr_free(device);
    451445
    452446        /* OK, continue with main loop */
     
    482476        flaws_str = tmp1;
    483477        mr_free(tmp);
     478        /* BERLIOS: Flawed since rev 1 !! */
     479        res++;
    484480    }
    485481    if (res) {
     
    521517
    522518    prev_part_no = 0;
    523     // BERLIOS : useless ? tmp[0] = '\0';
    524 
    525519
    526520    physical_drive_size = get_phys_size_of_drive(drive);
     
    582576                       || (curr_part_no <= 4 && prev_part_no > 0)) {
    583577                mr_asprintf(&tmp, " Gap between %s%d and %d.", drive,
    584                          prev_part_no, curr_part_no);
     578                        prev_part_no, curr_part_no);
    585579                log_it(tmp);
    586580                if (flaws_str) {
     
    716710        flaws_str = tmp1;
    717711        mr_free(tmp);
     712        /* BERLIOS: Flawed since rev 1 !! - Is it sure ?? */
     713        res++;
    718714    }
    719715
     
    743739
    744740    /*@ buffer *********************************************************** */
    745     struct list_of_disks *drivelist;
    746     char *tmp;
    747     char *tmp1;
    748     char *flaws_str;
     741    struct list_of_disks *drivelist = NULL;
     742    char *tmp = NULL;
     743    char *tmp1 = NULL;
     744    char *flaws_str = NULL;
    749745
    750746    /*@ int ************************************************************** */
     
    856852            && strcmp(curr_mountpoint, "raid")) {
    857853            mr_asprintf(&tmp, " %s %s's.", number_to_text(copies),
    858                      curr_mountpoint);
     854                    curr_mountpoint);
    859855            log_it(tmp);
    860856            mr_asprintf(&tmp1, "%s%s",flaws_str, tmp);
     
    887883
    888884    /*@ buffers ********************************************************* */
    889     char *drive;
    890     char *tmp;
     885    char *drive = NULL;
    891886
    892887    long long size;
     
    899894        mr_asprintf(&drive, mountlist->el[lino].device);
    900895        if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    901             mr_asprintf(&tmp,
    902                      "Not putting %s in list of drives: it's a virtual drive",
    903                      drive);
    904             mr_msg(8, tmp);
    905             mr_free(tmp);
     896            mr_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive);
    906897            continue;
    907898        }
     
    909900        size = mountlist->el[lino].size;
    910901        if (size == 0) {
    911             mr_asprintf(&tmp,
    912                      "Not putting %s in list of drives: it has zero size (maybe an LVM volume)",
    913                      drive);
    914             mr_msg(8, tmp);
    915             mr_free(tmp);
     902            mr_msg(8, "Not putting %s in list of drives: it has zero size (maybe an LVM volume)", drive);
    916903            continue;
    917904        }
    918905
    919 /*
    920       for (i = strlen (drive); isdigit (drive[i - 1]); i--);
    921       drive[i] = '\0';
    922       if (get_phys_size_of_drive (drive) <= 0 && drive[i - 1] == 'p')
    923     {
    924       i--;
    925       drive[i] = '\0';
    926     }
    927       for (j = 0; j < noof_drives && strcmp (drivelist[j], drive) != 0; j++);
    928 */
    929 
    930         mr_asprintf(&tmp,
    931                  "Putting %s with size %lli in list of drives",
    932                  drive, size);
    933         mr_msg(8, tmp);
    934         mr_free(tmp);
     906        mr_msg(8, "Putting %s with size %lli in list of drives", drive, size);
    935907
    936908        (void) truncate_to_drive_name(drive);
     
    960932 */
    961933void make_list_of_unallocated_raid_partitions(struct mountlist_itself
    962                                               *output_list, struct mountlist_itself
    963                                               *mountlist, struct raidlist_itself
     934                                              *output_list,
     935                                              struct mountlist_itself
     936                                              *mountlist,
     937                                              struct raidlist_itself
    964938                                              *raidlist)
    965939{
     
    971945
    972946    /*@ buffers ********************************************************* */
    973     char *tmp;
     947    char *tmp = NULL;
    974948
    975949    assert(output_list != NULL);
     
    10431017int load_mountlist(struct mountlist_itself *mountlist, char *fname)
    10441018{
    1045     FILE *fin;
     1019    FILE *fin = NULL;
    10461020    /* malloc ** */
    10471021    char *incoming = NULL;
    1048     char *siz;
    1049     char *tmp;
    1050     char *p;
    1051 
    1052     int items;
    1053     int j;
     1022    char *siz = NULL;
     1023    char *tmp = NULL;
     1024    char *p = NULL;
     1025
     1026    int items = 0;
     1027    int j = 0;
    10541028    size_t n = 0;
    10551029
    10561030    assert(mountlist != NULL);
    10571031    assert_string_is_neither_NULL_nor_zerolength(fname);
    1058     malloc_string(siz);
     1032
    10591033    if (!(fin = fopen(fname, "r"))) {
    10601034        log_it("Unable to open mountlist - '%s'", fname);
    10611035        log_to_screen(_("Cannot open mountlist"));
    1062         mr_free(siz);
    10631036        return (1);
    10641037    }
    1065     items = 0;
     1038    malloc_string(siz);
    10661039    mr_getline(&incoming, &n, fin);
    10671040    log_it("Loading mountlist...");
     
    11301103            mr_free(tmp);
    11311104
    1132             mr_asprintf(&tmp,
    1133                      "%s %s %s %lld %s",
     1105            log_it("%s %s %s %lld %s",
    11341106                     mountlist->el[items].device,
    11351107                     mountlist->el[items].mountpoint,
     
    11371109                     mountlist->el[items].size,
    11381110                     mountlist->el[items].label);
    1139 
    1140             log_it(tmp);
    1141             mr_free(tmp);
    11421111            items++;
    11431112        }
     
    11491118
    11501119    log_it("Mountlist loaded successfully.");
    1151     mr_asprintf(&tmp, "%d entries in mountlist", items);
    1152     log_it(tmp);
    1153     mr_free(tmp);
     1120    log_it("%d entries in mountlist", items);
    11541121
    11551122    mr_free(siz);
    11561123    return (0);
    11571124}
    1158 
    11591125
    11601126
     
    12561222{
    12571223    /*@ mallocs *** */
    1258     char *device;
    1259     char *mountpoint;
    1260     char *format;
     1224    char *device = NULL;
     1225    char *mountpoint = NULL;
     1226    char *format = NULL;
    12611227
    12621228    long long size;
     
    12831249
    12841250    mountlist->el[b].size = size;
     1251    mr_free(device);
     1252    mr_free(mountpoint);
     1253    mr_free(format);
    12851254}
    12861255
  • trunk/mondo/src/common/libmondo-raid.c

    r1106 r1176  
    1010#include "my-stuff.h"
    1111#include "mr_str.h"
     12#include "mr_mem.h"
     13#include "mr_msg.h"
     14
    1215#include "mondostructures.h"
    1316#include "newt-specific-EXT.h"
     
    1619#include "libmondo-string-EXT.h"
    1720#include "libmondo-raid.h"
    18 #include "mr_mem.h"
    19 #include "mr_str.h"
    20 #include "mr_mem.h"
    2121
    2222#ifdef __FreeBSD__
     
    4747#else
    4848    /*@ buffer ********************************************************** */
    49     char *command;
    50     int res;
     49    char *command = NULL;
     50    int res = 0;
    5151
    5252    if (raidno == -1) {
     
    228228#endif
    229229
     230
    230231/**
    231232 * Save the additional RAID variables to a stream.
     
    316317#ifdef __FreeBSD__
    317318    int i, j;
     319    char *org = NULL;
    318320
    319321    fprintf(fout, "\nvolume %s\n", raidrec->volname);
    320322    for (i = 0; i < raidrec->plexes; ++i) {
    321         char *org;
    322323        switch (raidrec->plex[i].raidlevel) {
    323324        case -1:
    324             mr_asprintf(&org, "%s", "concat");
     325            mr_asprintf(&org, "concat");
    325326            break;
    326327        case 0:
    327             mr_asprintf(&org, "%s", "striped");
     328            mr_asprintf(&org, "striped");
    328329            break;
    329330        case 5:
    330             mr_asprintf(&org, "%s", "raid5");
     331            mr_asprintf(&org, "raid5");
    331332            break;
    332333        }
     
    422423    for (mr_getline(&incoming, &n, fin); !feof(fin);
    423424         mr_getline(&incoming, &n, fin)) {
    424         strip_spaces(incoming);
     425        mr_strip_spaces(incoming);
    425426        p = strchr(incoming, ' ');
    426427        if (strlen(incoming) < 3 || incoming[0] == '#' || !p) {
     
    450451                               char *fname)
    451452{
    452     FILE *fin;
    453     char *tmp1;
    454     int items;
     453    FILE *fin = NULL;
     454    int items = 0;
    455455
    456456    raidlist->spares.entries = 0;
     
    499499            }
    500500        } else if (!strcmp(argv[0], "volume")) {
    501             char *volname;
     501            char *volname = NULL;
    502502            if (argc < 2)
    503503                continue;
     
    508508        } else if (!strcmp(argv[0], "plex")) {
    509509            int raidlevel, stripesize;
    510             char *org = 0;
    511             char **tmp = 0;
     510            char *org = NULL;
     511            char **tmp = NULL;
    512512            if (argc < 3)
    513513                continue;
     
    546546        } else if ((!strcmp(argv[0], "sd"))
    547547                   || (!strcmp(argv[0], "subdisk"))) {
    548             char *drive = 0;
     548            char *drive = NULL;
    549549            if (argc < 3)
    550550                continue;
     
    565565    fclose(fin);
    566566    log_it("Raidtab loaded successfully.");
    567     mr_asprintf(&tmp1, "%d RAID devices in raidtab", raidlist->entries);
    568     log_it(tmp1);
    569     mr_free(tmp1);
     567    log_it("%d RAID devices in raidtab", raidlist->entries);
    570568    return (0);
    571569}
     
    647645
    648646    /*@ add mallocs * */
    649     char *tmp = NULL;
    650647    char *labelB = NULL;
    651648    char *valueB = NULL;
     
    701698        }
    702699        if (!disklist) {
    703             mr_asprintf(&tmp,
    704                      "Ignoring '%s %s' pair of disk %s", labelB, valueB,
    705                      label);
    706             log_it(tmp);
    707             mr_free(tmp);
     700            log_it("Ignoring '%s %s' pair of disk %s", labelB, valueB,
     701                    label);
    708702        } else {
    709703            add_disk_to_raid_device(disklist, value, atoi(valueB));
     
    932926  const char delims[] = " ";
    933927
    934   FILE   *fin;
    935   int    row, i, index_min;
     928  FILE *fin = NULL;
     929  int row = 0;
     930  int i = 0;
     931  int index_min = 0;
    936932  int lastpos = 0;
    937933  size_t len = 0;
    938   char   *token;
     934  char *token = NULL;
    939935  char *string = NULL;
    940   char *pos;
    941   char type;
    942   char *strtmp;
     936  char *pos = NULL;
     937  char type = NULL;
     938  char *strtmp = NULL;
    943939
    944940  // open file
     
    982978    mr_asprintf(&strtmp,"%s%s", device_prefix, token);
    983979    raidlist->el[raidlist->entries].raid_device = strtmp;
     980    mr_free(strtmp);
    984981    mr_free(token);
    985982    // skip ':' and status
  • trunk/mondo/src/common/libmondo-stream.c

    r1086 r1176  
    1414#include "my-stuff.h"
    1515#include "mr_mem.h"
     16#include "mr_msg.h"
     17
    1618#include "mondostructures.h"
    1719#include "libmondo-devices.h"
     
    2325#include "libmondo-tools-EXT.h"
    2426#include "libmondo-fifo-EXT.h"
    25 #include "mr_mem.h"
    2627
    2728#define EXTRA_TAPE_CHECKSUMS
    2829
     30/*@unused@*/
     31//static char cvsid[] = "$Id$";
    2932extern bool g_sigpipe;
    3033extern int g_tape_buffer_size_MB;
     
    132135    }
    133136    mr_free(blk);
    134     mr_free((void *)g_tapecatalog);
     137    mr_free(g_tapecatalog);
    135138    return (retval);
    136139}
     
    151154
    152155    /*@ long long's ************************************************* */
    153     int i;
    154     char *blk;
     156    int i = 0;
     157    char *blk = NULL;
    155158
    156159    blk = (char *) mr_malloc(256 * 1024);
     
    186189    }
    187190    mr_free(blk);
    188     mr_free((void *)g_tapecatalog);
     191    mr_free(g_tapecatalog);
    189192    return (retval);
    190193}
     
    251254
    252255    mr_asprintf(&command,
    253              "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1",
    254              cdr_exe);
     256            "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1",
     257            cdr_exe);
    255258    tmp = call_program_and_get_last_line_of_output(command);
    256259    mr_free(command);
     
    264267
    265268    mr_asprintf(&command,
    266              "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1",
    267              cdr_exe);
     269            "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1",
     270            cdr_exe);
    268271    mr_free(cdr_exe);
    269272
     
    339342    }
    340343}
     344
    341345
    342346int read_EXAT_files_from_tape(struct s_bkpinfo *bkpinfo,
     
    450454{
    451455    int i;
    452     char *tmp;
     456    char *tmp = NULL;
    453457
    454458    log_it("Insisting on tape #%d", tapeno);
     
    488492
    489493
    490 
    491 
    492494/**
    493495 * Add a file to a collection of recently archived filesets/slices.
     
    507509    int last, curr, i;
    508510    t_archtype type = other;
    509     char *command;
    510     char *tmpdir;
    511     char *old_fname;
     511    char *command = NULL;
     512    char *tmpdir = NULL;
     513    char *old_fname = NULL;
    512514
    513515    bufsize_K = (long long) (1024LL * (1 + g_tape_buffer_size_MB));
    514     mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td);
    515516    if (strstr(latest_fname, ".afio.") || strstr(latest_fname, ".star.")) {
    516517        type = fileset;
     
    522523            ("Unknown type. Internal error in maintain_collection_of_recent_archives()");
    523524    }
     525
     526    mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td);
    524527    mkdir(tmpdir, 0x700);
    525528    mr_asprintf(&command, "cp -f %s %s", latest_fname, tmpdir);
     
    603606{
    604607    /*@ buffer ***************************************************** */
    605     char *datablock;
    606     char *tmp;
     608    char *datablock = NULL;
     609    char *tmp = NULL;
    607610    char old_cwd[MAX_STR_LEN];
    608     char *outfname;
     611    char *outfname = NULL;
    609612    /*@ int ******************************************************* */
    610613    int i;
     
    649652    log_to_screen(_("Reading stream"));
    650653    log_it("stream device = '%s'", bkpinfo->media_device);
    651 /* skip data disks */
     654    /* skip data disks */
    652655    open_evalcall_form("Skipping data disks on stream");
    653656    log_to_screen(_("Skipping data disks on stream"));
     
    712715{
    713716    /*@ buffers ***************************************************** */
    714     char *command;
     717    char *command = NULL;
    715718
    716719    /*@ end vars *************************************************** */
     
    832835{
    833836    /*@ buffers ***************************************************** */
    834     char *tmp;
    835     char *datablock;
     837    char *tmp = NULL;
     838    char *datablock = NULL;
    836839    char *temp_fname = (char *)bkpinfo; /* Should NOT be NULL */
    837840    char *temp_cksum = (char *)bkpinfo; /* Should NOT be NULL */
    838     char *actual_cksum;
     841    char *actual_cksum = NULL;
    839842
    840843    /*@ int ********************************************************* */
     
    12891292{
    12901293    int res = 0;
    1291     char *command;
     1294    char *command = NULL;
    12921295
    12931296    paranoid_pclose(g_tape_stream);
     
    13481351{
    13491352    int i, last, res = 0;
    1350     char *fname;
     1353    char *fname = NULL;
    13511354
    13521355    mr_msg(2, "I am now writing back catalog to tape");
     
    13871390{
    13881391    /*@ pointers *************************************************** */
    1389     FILE *fin;
    1390     char *tmp;
     1392    FILE *fin = NULL;
     1393    char *tmp = NULL;
    13911394
    13921395    /*@ long ******************************************************* */
     
    14491452{
    14501453    /*@ buffers **************************************************** */
    1451     char *tmp;
     1454    char *tmp = NULL;
    14521455    char datablock[TAPE_BLOCK_SIZE];
    1453     char *checksum;
    1454     char *infile_basename;
     1456    char *checksum = NULL;
     1457    char *infile_basename = NULL;
    14551458
    14561459    /*@ int ******************************************************** */
     
    15701573    /*@ buffers **************************************************** */
    15711574    char tempblock[TAPE_BLOCK_SIZE];
    1572     char *tmp;
    15731575    char *p;
    15741576
     
    16031605        fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    16041606               g_tape_stream) / 1024;
    1605     mr_asprintf(&tmp, "%s (fname=%s, size=%ld K)",
    1606              marker_to_string(control_char), p,
    1607              (long) length_of_incoming_file >> 10);
    1608     mr_msg(6, tmp);
    1609     mr_free(tmp);
     1607    mr_msg(6, "%s (fname=%s, size=%ld K)",
     1608            marker_to_string(control_char), p,
     1609            (long) length_of_incoming_file >> 10);
    16101610    return (0);
    16111611}
     
    16201620{
    16211621    /*@ buffer ***************************************************** */
    1622     char *tmp;
     1622    char *tmp = NULL;
    16231623
    16241624
Note: See TracChangeset for help on using the changeset viewer.