Changeset 1152 in MondoRescue for branches/stable/mondo/src/lib/mr_mem.c


Ignore:
Timestamp:
Feb 12, 2007, 11:49:41 PM (14 years ago)
Author:
Bruno Cornec
Message:

More memory updates around mondoarchive (addition of mr_setenv) (based on ideas sent as patches by Michel)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/lib/mr_mem.c

    r1138 r1152  
    8989    mr_asprintf_int(&alloc, line, file, orig);
    9090}
     91
     92/*
     93 * Function that properly put a variable in the environment
     94 */
     95void mr_setenv_int(const char *name, const char *value, int line, char *file) {
     96   
     97    if (name == NULL) {
     98        mr_msg_int(1,line,file,"Unable to setenv a NULL variable\nExiting...");
     99        mr_exit(-1, "Unable to setenv a NULL variable");
     100    }
     101    if (value == NULL) {
     102        mr_msg_int(1,line,file,"Unable to affect NULL to %s\nExiting...", name);
     103        mr_exit(-1, "Unable to affect a NULL variable");
     104    }
     105    if (mr_setenv(name, value, 1) != 0) {
     106        mr_msg_int(1,line,file,"Unable to put %s in environment", name);
     107        mr_exit(-1,"Unable to put in environment");
     108    }
     109}
Note: See TracChangeset for help on using the changeset viewer.