Changeset 3193 for branches/3.1


Ignore:
Timestamp:
Sep 29, 2013, 9:31:34 AM (6 years ago)
Author:
bruno
Message:
  • Finish with backports from 3.1 for now. Still some work to do, but we will now make that version compile and work again and serve as a base

so the gettext patch can be added

Location:
branches/3.1/mondo/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/mondo/src/include/mr_str.h

    r2421 r3193  
    1616
    1717extern char *mr_strtok(char *instr, const char *delims, int *lastpos);
    18 extern char *mr_stresc(char *instr, char *toesc, const char escchr);
    19 extern char *mr_date(void);
     18extern char *mr_stresc(char *instr, char *toesc, const char escchr, const char specialchr);
     19extern inline char *mr_date(void);
    2020extern void mr_strip_spaces(char *in_out);
    2121extern void mr_strip_char(char *in_out, char *caracs);
  • branches/3.1/mondo/src/include/my-stuff.h

    r3147 r3193  
    339339#define ARCH_THREADS 2          ///< The number of simultaneous threads running afio in the background.
    340340#define ARCH_BUFFER_NUM (ARCH_THREADS*4)    // Number of permissible queued afio files
     341#define FORTY_SPACES "                                         "    ///< 40 spaces.
    341342#define DO_MBR_PLEASE "/tmp/DO-MBR-PLEASE"
    342343#define MONDO_MNTLISTCHG "/tmp/mountlist.changed"
  • branches/3.1/mondo/src/lib/mr_str.c

    r3147 r3193  
    1212
    1313#include "mr_mem.h"
     14
     15// to get bool type
     16#define _MY_STUFF_H_
     17#include "my-stuff.h"
    1418 
    1519/**
     
    6670 * @note this function allocates memory that needs to be freed by caller
    6771 **/
    68 char *mr_stresc(char *instr, char *toesc, const char escchr) {
     72char *mr_stresc(char *instr, char *toesc, const char escchr, const char specialchr) {
    6973    char *inptr = NULL;
    7074    char *retstr = NULL;
     
    7276    char *escptr = NULL;
    7377    int cnt = 0;
     78    bool found = FALSE;
    7479
    7580    inptr = instr;
    76 
    7781    // Count how many characters need escaping.
    7882    while (*inptr != '\0') {
     
    8286                // Found it, skip the rest.
    8387                cnt++;
     88                // if specialchar (' or ") then replace it with '\'' or "\"" so adds 2 chars
     89                if (*inptr == specialchr) {
     90                    cnt += 2;
     91                }
    8492                break;
    8593            }
     
    8896        inptr++;
    8997    }
     98
    9099    inptr = instr;
    91 
    92100    retstr = (char *) mr_malloc(strlen(inptr) + cnt + 1);
    93101    retptr = retstr;
     
    99107            if (*inptr == *escptr) {
    100108                // Found it, skip the rest.
    101                 *retptr = escchr;
    102                 retptr++;
     109                // if specialchar (' or ") then replace it with '\'' or "\"" so adds 2 chars
     110                if (*inptr == specialchr) {
     111                    *retptr = specialchr;
     112                    retptr++;
     113                    *retptr = escchr;
     114                    retptr++;
     115                    found = TRUE;
     116                } else {
     117                    *retptr = escchr;
     118                    retptr++;
     119                }
    103120                break;
    104121            }
     
    108125        retptr++;
    109126        inptr++;
     127        if (found) {
     128            // finish to put the remaining specialchr
     129            *retptr = specialchr;
     130            retptr++;
     131            found = FALSE;
     132        }
    110133    }
    111134    *retptr = '\0';
     
    114137}
    115138
    116 /**
    117  * Remove all characters in caracs from begining and end of string @p in_out
    118  * @param in_out The string to strip char characters from (modified).
     139/* Return a string containing the date */
     140char *mr_date(void) {
     141   
     142    time_t tcurr;
     143
     144    tcurr = time(NULL);
     145    return(ctime(&tcurr));
     146}
     147
     148/* Return an allocated string containing the date
     149char *mr_date(void) {
     150   
     151    time_t tcurr;
     152    char *tmp = NULL;
     153
     154    tcurr = time(NULL);
     155    mr_asprintf(tmp, "%s", ctime(&tcurr));
     156    mr_chomp(tmp);
     157    return(tmp);
     158}
    119159 */
    120 void mr_strip_char(char *in_out, char *caracs) {
    121     int i = 0;
    122     int j = 0;
    123     int length = 0;
    124 
    125     if (caracs == NULL) {
    126         return;
    127     }
    128     if (in_out == NULL) {
    129         return;
    130     }
    131     length = (int)strlen(in_out);
    132 
    133     /* Skip initial caracs */
    134     for (i = 0; index(caracs, in_out[i]) != NULL && i < length ; i++);
    135 
    136     /* Shift the string to the begining if needed */
    137     if (i != 0) {
    138         for (j = 0; i < length ; i++, j++) {
    139             in_out[j] = in_out[i];
    140         }
    141         /* Erase the end of the string if needed */
    142         j++;
    143         in_out[j] = '\0';
    144     }
    145 
    146     /* Skip final spaces and special chars */
    147     for (i = (int)strlen(in_out) - 1; i >= 0  && index(caracs, in_out[i]) != NULL; i--);
    148 
    149     /* The string now ends after that char */
    150     i++;
    151     in_out[i] = '\0';
    152 }
    153160
    154161/**
     
    158165 */
    159166void mr_strip_spaces(char *in_out) {
    160 
    161     int i;
    162     char *tmp = NULL;
    163 
    164     mr_asprintf(tmp, "");
    165 
    166     /* Build the string of char to avoid: ctrl char up to space*/
    167     for (i = 0; i <= ' '; i++) {
    168         mr_strcat(tmp, "%c", i);
    169     }
    170    
    171     mr_strip_char(in_out, tmp);
    172     mr_free(tmp);
    173 }
     167    int i = 0;
     168    int j = 0;
     169    size_t length;
     170
     171    if (in_out == NULL) {
     172        return;
     173    }
     174    length = strlen(in_out);
     175
     176    /* Skip initial spaces and special chars */
     177    for (i = 0; in_out[i] <= ' ' && i < (int)length ; i++);
     178    /* Shift the string to the begining if needed */
     179    if (i != 0) {
     180        for (j = 0; i < (int)length ; i++, j++) {
     181            in_out[j] = in_out[i];
     182        }
     183        /* Erase the end of the string if needed */
     184        j++;
     185        in_out[j] = '\0';
     186    }
     187
     188    /* Skip final spaces and special chars */
     189    for (i = (int)strlen(in_out) - 1; i >= 0  && in_out[i] <= ' '; i--);
     190
     191    /* The string now ends after that char */
     192    i++;
     193    in_out[i] = '\0';
     194}
     195
    174196
    175197/*
    176198 * Remove '\n' char from both sides of @p in_out.
    177199 * @param in_out The string to strip characters from (modified).
    178  */
     200
    179201void mr_chomp(char *in_out) {
    180202
    181203    mr_strip_char(in_out, "\n");
    182204}
    183 
    184 /* Return an allocated string containing the date */
    185 char *mr_date(void) {
    186    
    187     time_t tcurr;
    188     char *tmp = NULL;
    189 
    190     tcurr = time(NULL);
    191     mr_asprintf(tmp, "%s", ctime(&tcurr));
    192     mr_chomp(tmp);
    193     return(tmp);
    194 }
    195 
    196 
     205*/
     206
     207/**
     208 * Remove all characters in caracs from begining and end of string @p in_out
     209 * @param in_out The string to strip char characters from (modified).
     210
     211void mr_strip_char(char *in_out, char *caracs) {
     212    int i = 0;
     213    int j = 0;
     214    size_t length = 0;
     215
     216    if (caracs == NULL) {
     217        return;
     218    }
     219    if (in_out == NULL) {
     220        return;
     221    }
     222    length = strlen(in_out);
     223
     224    /* Skip initial caracs */
     225    for (i = 0; index(caracs, in_out[i]) != NULL && i < (int)length ; i++);
     226
     227    /* Shift the string to the begining if needed */
     228    if (i != 0) {
     229        for (j = 0; i < (int)length ; i++, j++) {
     230            in_out[j] = in_out[i];
     231        }
     232        /* Erase the end of the string if needed */
     233        j++;
     234        in_out[j] = '\0';
     235    }
     236
     237    /* Skip final caracs */
     238    for (i = (int)strlen(in_out) - 1; i >= 0  && index(caracs, in_out[i]) != NULL; i--);
     239
     240    /* The string now ends after that char */
     241    i++;
     242    in_out[i] = '\0';
     243}
     244*/
     245
  • branches/3.1/mondo/src/mondoarchive/mondoarchive.c

    r3148 r3193  
    3737extern t_bkptype g_backup_media_type;
    3838extern int g_loglevel;
     39
    3940extern char *g_magicdev_command;
    4041
     
    101102    log_msg(7, "Seven...");
    102103    log_msg(8, "Eight...");
     104    printf("See %s for details of backup run.\n", MONDO_LOGFILE);
    103105}
    104106
     
    164166    FILE *fin = NULL;
    165167
     168/* Make sure I'm root; abort if not */
     169    if (getuid() != 0) {
     170        fprintf(stderr, "Please run as root.\r\n");
     171        exit(127);
     172    }
     173
     174/* If -V, -v or --version then echo version no. and quit */
     175    if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) {
     176        printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);
     177        exit(0);
     178    }
     179
     180/* Initialize variables */
     181
    166182    printf("Initializing...\n");
     183
     184    init_bkpinfo();
     185
     186    /* Memory allocation is done in those functions */
     187    malloc_libmondo_global_strings();
    167188
    168189    /* initialize log file with time stamp */
    169190    unlink(MONDO_LOGFILE);
    170     tmp = mr_date();
    171     log_msg(0, "Time started: %s", tmp);
    172     mr_free(tmp);
    173 
    174     init_bkpinfo();
    175 
    176     /* Memory allocation is done in those functions */
    177     malloc_libmondo_global_strings();
     191    log_msg(0, "Time started: %s", mr_date());
     192
    178193    if (argc == 1) {
    179194        g_text_mode = FALSE;
     
    188203    }
    189204    setup_newt_stuff();
    190 
    191     /* Make sure I'm root; abort if not */
    192     if (getuid() != 0) {
    193         fatal_error("Please run as root.\n");
    194     }
    195 
    196     /* If -V, -v or --version then echo version no. and quit */
    197     if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) {
    198         printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);
    199         finish(0);
    200     }
    201 
    202205
    203206    /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
     
    449452
    450453    /* finalize log file with time stamp */
    451     tmp = mr_date();
    452     log_msg(0, "Time finished: %s", tmp);
    453     mr_free(tmp);
     454    log_msg(0, "Time finished: %s", mr_date());
    454455
    455456    if (chdir("/tmp")) {
  • branches/3.1/mondo/src/mondorestore/mondo-prep.c

    r3161 r3193  
    4343extern char *MONDO_LOGFILE;
    4444
     45// FIXME: is it really usefull - maps to /tmp/prep.sh ??
    4546FILE *g_fprep = NULL;
    4647extern char *g_mondo_cfg_file;  // where m*ndo-restore.cfg (the config file) is stored
     
    108109            sync();
    109110            sync();
    110             popup_and_OK
    111                 ("I must now reboot. Please leave the boot media in the drive and repeat your actions - e.g. type 'nuke' - and it should work fine.");
     111            popup_and_OK("I must now reboot. Please leave the boot media in the drive and repeat your actions - e.g. type 'nuke' - and it should work fine.");
    112112            paranoid_system("reboot");
    113113        }
    114114    }
    115 // Still here? Cool!
     115    // Still here? Cool!
    116116    log_msg(1, "Cool. I didn't have to wipe anything.");
    117117}
     
    218218    }
    219219
     220    // TODO: FIXME
    220221    command = malloc(1024);
    221222
     
    390391        }
    391392        mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command);
    392         if (system(tmp1)) {
    393             //FIXME
    394         }
     393        paranoid_system(tmp1);
    395394        mr_free(tmp1);
    396395        sleep(1);
     
    515514        }
    516515    }
    517     paranoid_free(incoming);
    518516
    519517    return (0);
     
    539537    char *level   = NULL;
    540538    char *program = NULL;
    541     char *strtmp = NULL;
    542539    char *oldmd = NULL;
    543540
    544   // leave straight away if raidlist is initial or has no entries
    545   if (!raidlist || raidlist->entries == 0) {
    546     log_msg(1, "No RAID arrays found.");
    547     return 1;
    548   } else {
    549     log_msg(1, "%d RAID arrays found.", raidlist->entries);
    550   }
    551   // find raidlist entry for requested device
    552   for (i = 0; i < raidlist->entries; i++) {
    553     if (!strcmp(raidlist->el[i].raid_device, device)) break;
    554   }
    555   // check whether RAID device was found in raidlist
    556   if (i == raidlist->entries) {
    557     log_msg(1, "RAID device %s not found in list.", device);
    558     return 1;
    559   }
    560   // create device list from normal disks followed by spare ones
    561   mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device);
    562   for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
    563     mr_asprintf(strtmp, "%s", devices);
    564     mr_free(devices);
    565     mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].data_disks.el[j].device);
    566     mr_free(strtmp);
    567   }
    568   for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
    569     mr_asprintf(strtmp, "%s", devices);
    570     mr_free(devices);
    571     mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].spare_disks.el[j].device);
    572     mr_free(strtmp);
    573   }
    574   // translate RAID level
    575   if (raidlist->el[i].raid_level == -2) {
    576     mr_asprintf(level, "multipath");
    577   } else if (raidlist->el[i].raid_level == -1) {
    578     mr_asprintf(level, "linear");
    579   } else {
    580     mr_asprintf(level, "raid%d", raidlist->el[i].raid_level);
    581   }
    582   // create RAID device:
    583   // - RAID device, number of devices and devices mandatory
    584   // - parity algorithm, chunk size and spare devices optional
    585   // - faulty devices ignored
    586   // - persistent superblock always used as this is recommended
    587 
    588   mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd);
    589   mr_free(oldmd);
    590   if (raidlist->el[i].parity != -1) {
    591     mr_asprintf(strtmp, "%s", program);
    592     mr_free(program);
    593     switch(raidlist->el[i].parity) {
    594     case 0:
    595       mr_asprintf(program, "%s --parity=%s", strtmp, "la");
    596       break;
    597     case 1:
    598       mr_asprintf(program, "%s --parity=%s", strtmp, "ra");
    599       break;
    600     case 2:
    601       mr_asprintf(program, "%s --parity=%s", strtmp, "ls");
    602       break;
    603     case 3:
    604       mr_asprintf(program, "%s --parity=%s", strtmp, "rs");
    605       break;
    606     default:
    607       fatal_error("Unknown RAID parity algorithm.");
    608       break;
    609     }
    610     mr_free(strtmp);
    611   }
    612   if (raidlist->el[i].chunk_size != -1) {
    613     mr_asprintf(strtmp, "%s", program);
    614     mr_free(program);
    615     mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);
    616     mr_free(strtmp);
    617   }
    618   if (raidlist->el[i].spare_disks.entries > 0) {
    619     mr_asprintf(strtmp, "%s", program);
    620     mr_free(program);
    621     mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries);
    622     mr_free(strtmp);
    623   }
    624   mr_asprintf(strtmp, "%s", program);
    625   mr_free(program);
    626   mr_asprintf(program, "%s %s", strtmp, devices);
    627   mr_free(strtmp);
    628   res = run_program_and_log_output(program, 1);
    629   mr_free(devices);
    630   mr_free(level);
    631   mr_free(program);
    632   return res;
     541    // leave straight away if raidlist is initial or has no entries
     542    if (!raidlist || raidlist->entries == 0) {
     543      log_msg(1, "No RAID arrays found.");
     544      return 1;
     545    } else {
     546      log_msg(1, "%d RAID arrays found.", raidlist->entries);
     547    }
     548    // find raidlist entry for requested device
     549    for (i = 0; i < raidlist->entries; i++) {
     550      if (!strcmp(raidlist->el[i].raid_device, device)) break;
     551    }
     552    // check whether RAID device was found in raidlist
     553    if (i == raidlist->entries) {
     554      log_msg(1, "RAID device %s not found in list.", device);
     555      return 1;
     556    } else {
     557      log_msg(1, "RAID device %s found in list (%d).", device, i);
     558    }
     559
     560    // create device list from normal disks followed by spare ones
     561    if (raidlist->el[i].data_disks.el[0].device != NULL) {
     562        mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device);
     563        log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[0].device);
     564    } else {
     565        log_msg(1, "Strange, there are entries but no device");
     566    }
     567    for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
     568      mr_strcat(devices, " %s", raidlist->el[i].data_disks.el[j].device);
     569      log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[j].device);
     570    }
     571    for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
     572      mr_strcat(devices, " %s", raidlist->el[i].spare_disks.el[j].device);
     573      log_msg(4, "Adding spare device %s to list", raidlist->el[i].spare_disks.el[j].device);
     574    }
     575    log_msg(4, "RAID devices: %s", devices);
     576    // translate RAID level
     577    if (raidlist->el[i].raid_level == -2) {
     578      mr_asprintf(level, "multipath");
     579    } else if (raidlist->el[i].raid_level == -1) {
     580      mr_asprintf(level, "linear");
     581    } else {
     582      mr_asprintf(level, "raid%d", raidlist->el[i].raid_level);
     583    }
     584    // create RAID device:
     585    // - RAID device, number of devices and devices mandatory
     586    // - parity algorithm, chunk size and spare devices optional
     587    // - faulty devices ignored
     588    // - persistent superblock always used as this is recommended
     589
     590    mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);
     591    mr_free(level);
     592    log_msg(4, "cmd built: %s", program);
     593    // Restoring the UUID and Version stored at backup time of present
     594    for (v = 0; v < raidlist->el[i].additional_vars.entries ; v++ ) {
     595        log_msg(4,"Working on additional param #%d (Label: %s)",v,raidlist->el[i].additional_vars.el[v].label);
     596        if ((raidlist->el[i].additional_vars.el[v].label != NULL) && (strcmp(raidlist->el[i].additional_vars.el[v].label,"UUID") == 0)) {
     597            // We have a UUID to handle
     598            if (raidlist->el[i].additional_vars.el[v].value != NULL) {
     599                // force its restoration in order to avoid modifying all conf files using it
     600                log_it("Managing previous UUID %s", raidlist->el[i].additional_vars.el[v].value);
     601                mr_strcat(program, " --uuid %s",raidlist->el[i].additional_vars.el[v].value);
     602                continue;
     603            } else {
     604                log_msg(1,"Unable to manage previous NULL UUID");
     605            }
     606        }
     607        if ((raidlist->el[i].additional_vars.el[v].label != NULL) && (strcmp(raidlist->el[i].additional_vars.el[v].label,"Version") == 0)) {
     608            // We have a Version to handle
     609            if (raidlist->el[i].additional_vars.el[v].value != NULL) {
     610                // force its restoration in order to support all complex boot loader + md format cases
     611                // Also see bug #473
     612                log_it("Managing previous Version %s", raidlist->el[i].additional_vars.el[v].value);
     613                mr_strcat(program, " -e %s",raidlist->el[i].additional_vars.el[v].value);
     614                continue;
     615            } else {
     616                log_msg(1,"Unable to manage previous NULL Version");
     617            }
     618        }
     619    }
     620        log_msg(4, "cmd built: %s", program);
     621    if (raidlist->el[i].parity != -1) {
     622      switch(raidlist->el[i].parity) {
     623      case 0:
     624        mr_strcat(program, " --parity=%s", "la");
     625        break;
     626      case 1:
     627        mr_strcat(program, " --parity=%s", "ra");
     628        break;
     629      case 2:
     630        mr_strcat(program, " --parity=%s", "ls");
     631        break;
     632      case 3:
     633        mr_strcat(program, " --parity=%s", "rs");
     634        break;
     635      default:
     636        fatal_error("Unknown RAID parity algorithm.");
     637        break;
     638      }
     639    }
     640    log_msg(4, "cmd built: %s", program);
     641    if (raidlist->el[i].chunk_size != -1) {
     642        mr_strcat(program, " --chunk=%d", raidlist->el[i].chunk_size);
     643    }
     644    if (raidlist->el[i].spare_disks.entries > 0) {
     645        mr_strcat(program, " --spare-devices=%d", raidlist->el[i].spare_disks.entries);
     646    }
     647    log_msg(4, "cmd built: %s", program);
     648    mr_strcat(program, " %s", devices);
     649    log_msg(2, "RAID device re-created with the following command:\n%s\n", program);
     650    if (test == TRUE) {
     651        res = run_program_and_log_output(program, 1);
     652    } else {
     653        // test mode, always returns TRUE without executing the mdadm command
     654        res = TRUE;
     655    }
     656    // free memory
     657    mr_free(devices);
     658    mr_free(program);
     659    return res;
    633660}
    634661
     
    759786        sync();
    760787        sleep(1);
     788        if (g_fprep) {
     789            fprintf(g_fprep, "%s\n", program);
     790        }
    761791
    762792        log_msg(1, "Making %s", device);
     
    845875    return (retval);
    846876}
    847 
    848 
    849 
    850877
    851878
     
    10061033    if (g_partition_table_locked_up > 0) {
    10071034        if (retval > 0 && !interactively) {
    1008 //123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
     1035                //123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    10091036            log_to_screen("Partition table locked up %d times. At least one 'mkfs' (format) command", g_partition_table_locked_up);
    10101037            log_to_screen("failed. I think these two events are related. Sometimes, fdisk's ioctl() call");
     
    10151042                sync();
    10161043                sync();
    1017                 if (system("reboot")) {
    1018                     // FIXME
    1019                 }
     1044                paranoid_system("reboot");
    10201045            }
    10211046        } else {
     
    15581583
    15591584    if (pout_to_fdisk) {
    1560         // mark relevant partition as bootable
    1561         tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable "MINDI_CACHE"/mountlist.txt dummy",TRUE);
    1562         mr_asprintf(tmp, "a\n%s\n", tmp1);
    1563         mr_free(tmp1);
    1564 
    1565         fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    1566         mr_free(tmp);
    1567 
    15681585        // close fdisk
     1586        fput_string_one_char_at_a_time(pout_to_fdisk, "p\n");
    15691587        fput_string_one_char_at_a_time(pout_to_fdisk, "w\n");
    1570         sync();
    15711588        paranoid_pclose(pout_to_fdisk);
    15721589        sync();
    15731590        log_msg(0,"------------------- fdisk.log looks like this ------------------");
    15741591        mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
    1575         if (system(tmp)) {
    1576             // FIXME
    1577         }
     1592        paranoid_system(tmp);
    15781593        mr_free(tmp);
    15791594
    1580         log_msg(0,
    1581                 "------------------- end of fdisk.log... word! ------------------");
     1595        // mark relevant partition as bootable
     1596        mr_asprintf(tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename);
     1597        call_program_and_get_last_line_of_output(tmp1);
     1598        mr_free(tmp1);
     1599        log_msg(0,"------------------- end of fdisk.log...       ------------------");
     1600        sync();
     1601
    15821602        mr_asprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
    15831603        if (!run_program_and_log_output(tmp, 5)) {
     
    19471967#endif
    19481968    }
    1949     log_msg(1, tmp, "Setting %s's type to %s (%s)", partition, format, partcode);
     1969    log_msg(1, "Setting %s's type to %s (%s)", partition, format, partcode);
    19501970    mr_free(partition);
    19511971
     
    20092029        }
    20102030    }
    2011 
    20122031    mr_free(partcode);
     2032
    20132033    return (res);
    20142034}
     
    20802100    mr_asprintf(program, "vinum stop -f %s", raid_device);
    20812101#else
    2082         // use raidstop if it exists, otherwise use mdadm
    2083         if (run_program_and_log_output("which raidstop", FALSE)) {
     2102    // use raidstop if it exists, otherwise use mdadm
     2103    if (run_program_and_log_output("which raidstop", FALSE)) {
    20842104        mr_asprintf(program, "mdadm -S %s", raid_device);
    20852105    } else {
     
    22012221 * @return 0 for success, nonzero for failure.
    22022222 */
    2203 char *which_format_command_do_i_need(char *format)
     2223static char *which_format_command_do_i_need(char *format)
    22042224{
    22052225    /** buffers *********************************************************/
     
    22292249    } else if (strcmp(format, "ext4") == 0) {
    22302250        mr_asprintf(program, "mkfs -t ext4 -F -q");
    2231     } else if (strcmp(format, "btrfs") == 0) {
    2232               strcpy(program, "mkfs.btrfs");
    22332251    } else if (strcmp(format, "btrfs") == 0) {
    22342252              strcpy(program, "mkfs.btrfs");
  • branches/3.1/mondo/src/mondorestore/mondo-rstr-compare.c

    r3161 r3193  
    7676    paranoid_fclose(fin);
    7777
     78
     79    mr_asprintf(bigfile_fname, "%s", biggiestruct.filename);
     80    log_msg(2, "biggiestruct.filename = %s", biggiestruct.filename);
    7881    mr_asprintf(checksum, "%s", biggiestruct.checksum);
    79     mr_asprintf(bigfile_fname, "%s", biggiestruct.filename);
    80 
    81     log_msg(2, "biggiestruct.filename = %s", biggiestruct.filename);
    8282    log_msg(2, "biggiestruct.checksum = %s", biggiestruct.checksum);
    8383
     
    8585        mr_asprintf(tmp, "Comparing %s", bigfile_fname);
    8686        newtDrawRootText(0, 22, tmp);
    87         paranoid_free(tmp);
     87        mr_free(tmp);
    8888        newtRefresh();
    8989    }
    90     if (!checksum[0]) {
     90    if (checksum == NULL]) {
    9191        log_msg(2, "Warning - %s has no checksum", bigfile_fname);
    9292    }
    9393    if (!strncmp(bigfile_fname, "/dev/", 5)) {
    9494        log_msg(2, "IGNORING %s as begining with /dev", bigfile_fname);
     95        mr_free(checksum);
    9596        mr_free(bigfile_fname);
    9697        return (1);
     
    104105    mr_asprintf(tmp, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
    105106    paranoid_system(tmp);
    106     paranoid_free(tmp);
     107    mr_free(tmp);
    107108
    108109    if (i) {
    109110        log_OS_error("Warning - command failed");
     111        mr_free(checksum);
     112        mr_free(bigfile_fname);
    110113        return (1);
    111114    } else {
    112115        if (!(fin = fopen("/tmp/md5sum.txt", "r"))) {
    113             log_msg(2,
    114                     "Unable to open /tmp/md5sum.txt; can't get live checksum");
     116            log_msg(2, "Unable to open /tmp/md5sum.txt; can't get live checksum");
     117            mr_free(checksum);
    115118            mr_free(bigfile_fname);
    116119            return (1);
     
    135138
    136139    log_msg(1, tmp);
    137     paranoid_free(tmp);
     140    mr_free(tmp);
    138141
    139142    if (retval) {
     
    270273        } else {
    271274            // afio
     275            mr_asprintf(tmp, "%s", compressor_exe);
    272276            mr_free(compressor_exe);
    273             mr_asprintf(tmp, "%s", compressor_exe);
    274277            mr_asprintf(compressor_exe, "-P %s -Z", tmp);
    275278            mr_free(tmp);
     
    291294    }
    292295    mr_free(compressor_exe);
    293     paranoid_free(archiver_exe);
     296    mr_free(archiver_exe);
    294297
    295298#undef BUFSIZE
     
    474477    noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt");
    475478    if (noof_changed_files) {
    476         mr_asprintf(tmp, "%ld files do not match the backup            ", noof_changed_files);
    477         log_to_screen(tmp);
    478         mr_free(tmp);
     479        log_to_screen("%ld files do not match the backup            ", noof_changed_files);
    479480
    480481        mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);
     
    525526
    526527  /**************************************************************************
    527    * also deletes tmp/filelist.full & biggielist.txt _and_ tries to     *
     528   * also deletes tmp/filelist.full & tmp/biggielist.txt _and_ tries to     *
    528529   * restore them from start of tape, if available                          *
    529530   **************************************************************************/
     
    653654    }
    654655
    655     mvaddstr_and_log_it(g_currentY,
    656                         0, "Verifying archives against filesystem");
     656    mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");
    657657
    658658    mr_free(bkpinfo->media_device);
     
    711711    }
    712712
    713     mvaddstr_and_log_it(g_currentY,
    714                         0, "Verifying archives against filesystem");
     713    mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");
    715714    res = verify_tape_backups();
    716715    if (chdir(dir)) {
  • branches/3.1/mondo/src/mondorestore/mondo-rstr-newt.c

    r3161 r3193  
    212212        mr_strip_spaces(size_str);
    213213
    214         strip_spaces(device_str);
     214        mr_strip_spaces(device_str);
    215215        if (b_res == bOK) {
    216216            if (device_str[strlen(device_str) - 1] == '/') {
     
    480480            mr_free(tmp);
    481481            mr_free(prompt);
    482             mr_free(prompt);
    483482            return;
    484483        }
     
    530529
    531530    assert(raidrec != NULL);
    532 
    533     if (system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null")) {
    534         // FIXME
    535     }
     531    paranoid_system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    536532    personalities = last_line_of_file("/tmp/raid-personalities.txt");
    537533    mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities);
     
    583579    mr_free(tmp);
    584580    mr_free(prompt);
     581
    585582    raidrec->raid_level = out;
    586583#endif
     
    607604    int pos = 0;
    608605
    609     /** buffers ***********************************************************/
    610606    assert(mountlist != NULL);
    611607    assert(raidlist != NULL);
     
    931927                strcpy(g_strings_of_flist_window[i - 1], tmp1);
    932928                mr_free(tmp1);
     929
    933930                dummybool = g_is_path_selected[i];
    934931                g_is_path_selected[i] = g_is_path_selected[i - 1];
     
    16831680
    16841681    /** buffers ***********************************************************/
    1685     char title_of_editraidForm_window[MAX_STR_LEN];
     1682    char *title_of_editraidForm_window = NULL;
    16861683
    16871684    /** newt **************************************************************/
     
    17131710    memcpy((void *) &bkp_raidrec, (void *) raidrec,
    17141711           sizeof(struct vinum_plex));
    1715     sprintf(title_of_editraidForm_window, "%s.p%i",
    1716             raidlist->el[currline].volname, currline2);
     1712    mr_asprintf(title_of_editraidForm_window, "%s.p%i", raidlist->el[currline].volname, currline2);
    17171713    newtPushHelpLine
    17181714        ("   Please select a subdisk to edit, or edit this plex's parameters");
    17191715    newtOpenWindow(13, 3, 54, 18, title_of_editraidForm_window);
     1716    mr_free(title_of_editraidForm_window);
     1717
    17201718    for (;;) {
    17211719        int i;
     
    18881886        strcpy(raidrec->additional_vars.el[lino].value, p);
    18891887    }
     1888    mr_free(header);
     1889    mr_free(comment);
    18901890    mr_free(p);
    18911891}
     
    19531953    mr_asprintf(tmp, "%-24s %-24s %-8s  %s", "Device", "Mountpoint", "Format", "Size (MB)");
    19541954    headerMsg = newtLabel(2, 1, tmp);
     1955    mr_free(tmp);
     1956
    19551957    flawsLabelA = newtLabel(2, 13, "         ");
    19561958    flawsLabelB = newtLabel(2, 14, "         ");
     
    20442046    }
    20452047    newtFormDestroy(myForm);
    2046 
    2047     mr_free(flaws_str_A);
    2048     mr_free(flaws_str_B);
    2049     mr_free(flaws_str_C);
    2050     mr_free(tmp);
    2051 
    20522048    newtPopWindow();
    20532049    newtPopHelpLine();
     
    28292825                        disklist->el[currline].index = atoi(sz_res);
    28302826                    }
     2827
    28312828                    redraw_disklist(disklist, keylist, partitionsListbox);
    28322829                    mr_free(sz_res);
  • branches/3.1/mondo/src/mondorestore/mondo-rstr-tools.c

    r3161 r3193  
    9090    fatal_error("Cannot openin outfname");
    9191}
    92 for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) {
     92for (mr_getline(incoming, fin); !feof(fin) && (incoming != NULL); mr_getline(incoming, fin)) {
    9393    mr_strip_spaces(incoming);
    9494
     
    140140}
    141141if (file[0] == '/' && file[1] == '/') {
    142     mr_asprintf(tmp, "%s", file);
    143     mr_free(file);
     142    tmp = file;
    144143
    145144    mr_asprintf(file, "%s", tmp + 1);
     
    174173* @return 0 for success, nonzero for failure.
    175174*/
    176 int iso_fiddly_bits(bool nuke_me_please)
    177 {
    178     char *mount_isodir_command = NULL;
    179     char *command = NULL;
    180     char *mds = NULL;
    181     int retval = 0, i;
    182     char *isodir_format = NULL;
     175int iso_fiddly_bits(bool nuke_me_please) {
     176
     177char *mount_isodir_command = NULL;
     178char *command = NULL;
     179char *mds = NULL;
     180int retval = 0, i;
     181char *isodir_format = NULL;
    183182
    184183g_ISO_restore_mode = TRUE;
     
    305304            mr_strcat(additional_parameters, "-o ro");
    306305        }
     306        mr_free(tmp);
     307
    307308        tmp = find_home_of_exe("setfattr");
    308309        if (tmp) {
     
    374375mr_free(mountpoint);
    375376
    376     return (res);
     377return (res);
    377378}
    378379/**************************************************************************
     
    418419            mr_free(tmp);
    419420            res = mount_device(mountlist->el[lino].device, mountlist->el[lino].mountpoint, mountlist->el[lino].format, writeable);
    420 
    421421            retval += res;
    422422            if (res) {
     
    660660assert(bkpinfo != NULL);
    661661assert(cfgf != NULL);
     662log_it("Entering read_cfg_file_into_bkpinfo");
    662663
    663664media_specified_by_user = bkpinfo->backup_media_type;   // or 'none', if not specified
     
    676677        bkpinfo->please_dont_eject = TRUE;
    677678    } else if (!strcmp(value, "iso")) {
    678         // Patch by Conor Daly - 2004/07/12
    679679        bkpinfo->backup_media_type = iso;
    680680        if (am_I_in_disaster_recovery_mode()) {
     
    687687                bkpinfo->backup_media_type = cdr;
    688688                run_program_and_log_output("umount -d "MNT_CDROM, 1);
    689                 log_it
    690                     ("Re-jigging configuration AGAIN. CD-R, not ISO.");
     689                log_it("Re-jigging configuration AGAIN. CD-R, not ISO.");
    691690            }
    692691        }
     
    698697            mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
    699698        }
     699        log_it("Setting Prefix to %s", bkpinfo->prefix);
    700700    } else if ((!strcmp(value, "netfs")) || (!strcmp(value, "nfs"))) {
    701701        /* Stay compatible with previous versions by allowing nfs as an entry here */
     
    727727        tmp = call_program_and_get_last_line_of_output("cat " CMDLINE,TRUE);
    728728        if (strstr(tmp, "pxe")) {
    729             /* We need to override prefix value in PXE mode as it's 
     729            /* We need to override prefix value in PXE mode as it's
    730730            * already done in start-netfs */
    731731            envtmp1 = getenv("imgname");
     
    754754        mr_free(bkpinfo->media_device);
    755755        mr_asprintf(bkpinfo->media_device, "/dev/cdrom");
    756         bkpinfo->media_size[0] = 1999 * 1024;
    757         bkpinfo->media_size[1] = 650;   /* good guess */
     756        bkpinfo->media_size = 650;  /* good guess */
    758757    } else if (bkpinfo->backup_media_type == usb) {
    759758        envtmp1 = getenv("MRUSBDEV");
     
    778777        value = read_cfg_var(cfg_file, "media-size");
    779778        if (value != NULL) {
    780             bkpinfo->media_size[1] = atol(value);
     779            bkpinfo->media_size = atol(value);
    781780            mr_free(value);
    782781        } else {
    783             bkpinfo->media_size[1] = 0L;
     782            bkpinfo->media_size = 0L;
    784783        }
    785784        log_msg(2, "Backup medium is TAPE --- dev=%s", bkpinfo->media_device);
     
    787786        mr_free(bkpinfo->media_device);
    788787        mr_asprintf(bkpinfo->media_device, "/dev/cdrom");   /* we don't really need this var */
    789         bkpinfo->media_size[0] = 1999 * 1024;   /* 650, probably, but we don't need this var anyway */
    790         bkpinfo->media_size[1] = 1999 * 1024;   /* 650, probably, but we don't need this var anyway */
    791         log_msg(2, "Backup medium is CD-R[W]");
     788        bkpinfo->media_size = 1999 * 1024;  /* 650, probably, but we don't need this var anyway */
     789        log_msg(2, "Backup medium is similar to CD-R[W]");
    792790    }
    793791} else {
     
    968966        mr_free(tmp1);
    969967    }
    970 
    971968} else if (bkpinfo->backup_media_type == iso) {
    972969    /* Patch by Conor Daly 23-june-2004
     
    10441041    if (! bkpinfo->disaster_recovery) {
    10451042        if (bkpinfo->backup_media_type != media_specified_by_user) {
    1046             log_msg(2,
    1047                     "bkpinfo->backup_media_type != media_specified_by_user, so I'd better ask :)");
     1043            log_msg(2, "bkpinfo->backup_media_type != media_specified_by_user, so I'd better ask :)");
    10481044            interactively_obtain_media_parameters_from_user(FALSE);
    10491045            media_specified_by_user = bkpinfo->backup_media_type;
     
    10861082int res = 0;
    10871083pid_t pid;
     1084bool extract_mountlist_stub = FALSE;
    10881085
    10891086assert(bkpinfo != NULL);
     
    12341231            popup_and_OK("You'll now be chrooted under your future / partition.\nEdit /etc/mkinitcpio.conf if needed and rebuild your initrd with the kernel preset name e.g.\nmkinitcpio -p kernel26\nThen type exit to finish.\n");
    12351232        } else {
    1236             popup_and_OK("You'll now be chrooted under your future / partition.\nGo under /boot and rebuild your initrd with\nmkinitrd -f -v initrd-2.x.y.img 2.x.y e.g.\nThen type exit to finish.");
     1233            popup_and_OK("You'll now be chrooted under your future / partition.\nGo under /boot and rebuild your init(rd|ramfs) with\nmkinitrd -f -v initrd-2.x.y.img 2.x.y e.g.\nor initramfs, dracut, ... Then type exit to finish.");
    12371234        }
    12381235        mvaddstr_and_log_it(g_currentY, 0, "Modifying initrd...");
     
    14351432
    14361433            if ((res) || (mntlistchg)) {
    1437                 popup_and_OK("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install");
    1438             } else {
    1439                 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install");
    1440             }
    1441             if (!g_text_mode) {
    1442                 newtSuspend();
    1443             }
    1444             mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
    1445             paranoid_system(tmp);
    1446             mr_free(tmp);
    1447 
    1448             mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
    1449             paranoid_system(tmp);
    1450             mr_free(tmp);
    1451 
    1452             if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) {
    1453                 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
    1454             } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) {
    1455                 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor);
    1456             } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) {
    1457                 mr_asprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor);
    1458             }
    1459             paranoid_system(tmp);
    1460             mr_free(tmp);
    1461 
    1462             if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) {
     1434                if (res) {
     1435                    popup_and_OK("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install");
     1436                } else {
     1437                    popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install");
     1438                }
     1439                if (!g_text_mode) {
     1440                    newtSuspend();
     1441                }
     1442                mr_asprintf(editor, "%s", find_my_editor());
     1443                mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
     1444                paranoid_system(tmp);
     1445                mr_free(tmp);
     1446
     1447                mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
     1448                paranoid_system(tmp);
     1449                mr_free(tmp);
     1450   
     1451                if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) {
     1452                    mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
     1453                } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) {
     1454                    mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor);
     1455                } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) {
     1456                    mr_asprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor);
     1457                }
     1458                paranoid_system(tmp);
     1459                mr_free(tmp);
     1460   
     1461                if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) {
     1462                    mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);
     1463                } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) {
     1464                    mr_asprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor);
     1465                }
     1466                paranoid_system(tmp);
     1467                mr_free(tmp);
     1468
     1469                if (!g_text_mode) {
     1470                    newtResume();
     1471                }
     1472                mr_asprintf(command, "stabgrub-me %s", boot_device);
     1473                res = run_program_and_log_output(command, 1);
     1474                mr_free(command);
     1475
     1476                if (res) {
     1477                    popup_and_OK("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done.");
     1478                    newtSuspend();
     1479                    paranoid_system("chroot " MNT_RESTORING);
     1480                    newtResume();
     1481                    popup_and_OK("Thank you.");
     1482                } else {
     1483                    popup_and_OK("GRUB is now installed correctly");
     1484                    done = TRUE;
     1485                }
     1486                popup_and_OK("You will now edit fstab, mtab, device.map and menu.lst/grub.cfg");
     1487                if (!g_text_mode) {
     1488                    newtSuspend();
     1489                }
     1490   
     1491                mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
     1492                paranoid_system(tmp);
     1493                mr_free(tmp);
     1494   
     1495                mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
     1496                paranoid_system(tmp);
     1497                mr_free(tmp);
     1498   
     1499                if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) {
     1500                    mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
     1501                } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) {
     1502                    mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor);
     1503                }
     1504                paranoid_system(tmp);
     1505                mr_free(tmp);
     1506
    14631507                mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);
    1464             } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) {
    1465                 mr_asprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor);
    1466             }
    1467             paranoid_system(tmp);
    1468             mr_free(tmp);
    1469 
    1470             if (!g_text_mode) {
    1471                 newtResume();
    1472             }
    1473             mr_asprintf(command, "stabgrub-me %s", boot_device);
    1474             res = run_program_and_log_output(command, 1);
    1475             mr_free(command);
    1476             if (res) {
    1477                 popup_and_OK("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done.");
    1478                 newtSuspend();
    1479                 paranoid_system("chroot " MNT_RESTORING);
    1480                 newtResume();
    1481                 popup_and_OK("Thank you.");
    1482             } else {
    1483                 popup_and_OK("GRUB is now installed correctly");
    1484                 done = TRUE;
    1485             }
    1486             popup_and_OK("You will now edit fstab, mtab, device.map and menu.lst/grub.cfg");
    1487             if (!g_text_mode) {
    1488                 newtSuspend();
    1489             }
    1490             mr_asprintf(editor, "%s", find_my_editor());
    1491 
    1492             mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
    1493             paranoid_system(tmp);
    1494             mr_free(tmp);
    1495 
    1496             mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
    1497             paranoid_system(tmp);
    1498             mr_free(tmp);
    1499 
    1500             if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) {
    1501                 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
    1502             } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) {
    1503                 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor);
    1504             }
    1505             paranoid_system(tmp);
    1506             mr_free(tmp);
    1507 
    1508             mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);
    1509             paranoid_system(tmp);
    1510             mr_free(tmp);
    1511             mr_free(editor);
    1512 
    1513             if (!g_text_mode) {
    1514                 newtResume();
     1508                paranoid_system(tmp);
     1509                mr_free(tmp);
     1510                mr_free(editor);
     1511   
     1512                if (!g_text_mode) {
     1513                    newtResume();
     1514                }
    15151515            }
    15161516        }
     
    15251525            log_msg(1, "WARNING - grub-MR not found; using grub-install");
    15261526        }
    1527         mvaddstr_and_log_it(g_currentY,
    1528                             0,
    1529                             "Running GRUB...                                                 ");
     1527        mvaddstr_and_log_it(g_currentY, 0, "Running GRUB...                                                 ");
    15301528        log_it("%s",command);
    15311529        res = run_program_and_log_output(command, 1);
     
    16111609                paranoid_system(tmp);
    16121610                mr_free(tmp);
    1613 
    16141611                mr_free(editor);
    16151612
     
    16881685                paranoid_system(tmp);
    16891686                mr_free(tmp);
    1690 
    16911687                mr_free(editor);
    16921688
     
    21142110    paranoid_free(raidlist);
    21152111}
    2116 
    2117 
  • branches/3.1/mondo/src/mondorestore/mondoprep.h

    r3147 r3193  
    6969int partition_everything(struct mountlist_itself *);
    7070int do_my_funky_lvm_stuff(bool, bool);
    71 char *which_format_command_do_i_need(char *);
    7271int make_dummy_partitions(FILE *, char *, int);
    7372int make_list_of_drives(struct mountlist_itself *,
  • branches/3.1/mondo/src/mondorestore/mondorestore.c

    r3161 r3193  
    582582                    log_msg(1, "Restoring subset");
    583583                    retval += restore_everything(filelist);
     584                    free_filelist(filelist);
    584585                } else {
    585586                    mr_free(bkpinfo->restore_path);
     
    839840                        "Using tune2fs/tune4fs to identify your ext2,3,4 partitions");
    840841
    841     mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE);
     842    mr_asprintf(tmp1, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE);
    842843    res = run_program_and_log_output(tmp, TRUE);
    843     mr_free(tmp);
     844    mr_free(tmp1);
    844845    if (res) {
    845846        log_to_screen("label-partitions-as-necessary returned an error");
     
    20452046    int res;
    20462047    int attempts;
    2047     long current_tarball_number = 0;
     2048    long current_tarball_number = 0L;
    20482049    long max_val;
    20492050  /**malloc ***/
     
    26202621    mr_free(tmp1);
    26212622
     2623    mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));
     2624    raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself));
     2625
     2626
     2627
    26222628    /* Init GUI */
    26232629    setup_newt_stuff();         /* call newtInit and setup screen log */
     
    26662672
    26672673    log_it("what time is it");
    2668 
    2669     mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));
    2670     raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself));
    26712674
    26722675    /* Process command-line parameters */
     
    27992802        mount_boot_if_necessary();  /* for Gentoo users */
    28002803        log_msg(2, "Still here.");
    2801         /* Adding an initialisation in order to avoid to hndle NULL pointer later */
     2804        /* Adding an initialisation in order to avoid to handle NULL pointer later */
    28022805        mr_free(bkpinfo->restore_path);
    28032806        mr_asprintf(bkpinfo->restore_path, "%s", "/tmp");
Note: See TracChangeset for help on using the changeset viewer.