Changeset 783 in MondoRescue for trunk/mondo/mondo/common/libmondo-raid.c


Ignore:
Timestamp:
Aug 31, 2006, 5:09:20 PM (18 years ago)
Author:
Bruno Cornec
Message:
  • Massive rewrite continues for memory management.
  • main structure should now have all parameters allocated dynamically
  • new lib libmr.a + dir + build process reviewed to support it.
  • new include subdir to host external definitions of the new lib
  • code now compiles. Still one remaining link issues for mondorestore. This should allow for some tests soon.

(goal is to separate completely reviewed code and functions and provide clean interfaces)

File:
1 edited

Legend:

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

    r689 r783  
    99
    1010#include "my-stuff.h"
     11#include "mr_string.h"
    1112#include "mondostructures.h"
    1213#include "newt-specific-EXT.h"
     
    177178{
    178179    /*@ buffers ***************************************************** */
    179     char *sz_value;
     180    char *sz_value = NULL;
     181    char *sz_label = NULL;
    180182
    181183    assert(raidrec != NULL);
     
    183185
    184186    asprintf(&sz_value, "%d", value);
    185     strcpy(raidrec->additional_vars.el[lino].label, label);
    186     strcpy(raidrec->additional_vars.el[lino].value, sz_value);
    187     paranoid_free(sz_value);
     187    asprintf(&sz_label,label);
     188    raidrec->additional_vars.el[lino].value = sz_value;
     189    raidrec->additional_vars.el[lino].label = sz_label;
    188190}
    189191#endif
     
    956958    // trim leading spaces
    957959    pos = string;
    958     while (*pos == ' ') pos += 1;
     960    while (*pos == ' ') pos++;
    959961    asprintf(&strtmp, pos);
    960     strcpy(string, strtmp);
     962    paranoid_alloc(string,strtmp);
    961963    paranoid_free(strtmp);
    962964    // if we have newline after only spaces, this is a blank line, update
     
    979981    // get RAID device name
    980982    asprintf(&strtmp,"%s%s", device_prefix, token);
    981     strcpy(raidlist->el[raidlist->entries].raid_device, strtmp);
    982     paranoid_free(strtmp);
     983    raidlist->el[raidlist->entries].raid_device = strtmp;
    983984    paranoid_free(token);
    984985    // skip ':' and status
Note: See TracChangeset for help on using the changeset viewer.