Changeset 1176 in MondoRescue for trunk/mondo/src/common/libmondo-raid.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-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
Note: See TracChangeset for help on using the changeset viewer.