Changeset 2351 in MondoRescue


Ignore:
Timestamp:
Aug 28, 2009, 2:41:30 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Replacement of some fgets by mr_getline to allow for dyn. memory management.
  • Backport of SElinux fix from 2.2.9
Location:
branches/2.2.10
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/analyze-my-lvm

    r2244 r2351  
    8686    current_VG=$1
    8787    VG_info_file=$MINDI_TMP/$$.vg-info.txt
    88     $LVMCMD vgdisplay $current_VG > $VG_info_file
     88    # We use cat here as a way to avoid SElinux to prevent us from writing in $VG_info_file
     89    $LVMCMD vgdisplay $current_VG | cat > $VG_info_file
    8990    max_logical_volumes=`GetValueFromField "$VG_info_file" "MAX LV"`
    9091    [ $max_logical_volumes -ge 256 ] && max_logical_volumes=255
  • branches/2.2.10/mondo/src/common/libmondo-archive.c

    r2341 r2351  
    19271927
    19281928    /*@ pointers ******************************************* */
    1929     FILE *fin;
    1930     char *p;
     1929    FILE *fin = NULL;
    19311930
    19321931    /*@ buffers ******************************************** */
    19331932    char *tmp = NULL;
    1934     char *bigfile_fname;
     1933    char *bigfile_fname = NULL;
    19351934    char *sz_devfile = NULL;
    19361935    char *ntfsprog_fifo = NULL;
     
    19761975    }
    19771976
    1978     malloc_string(bigfile_fname);
    1979     for (fgets(bigfile_fname, MAX_STR_LEN, fin); !feof(fin);
    1980          fgets(bigfile_fname, MAX_STR_LEN, fin), biggie_file_number++) {
     1977    for (mr_getline(bigfile_fname, fin); !feof(fin); mr_getline(bigfile_fname, fin), biggie_file_number++) {
    19811978        use_ntfsprog = FALSE;
    19821979        if (bigfile_fname[strlen(bigfile_fname) - 1] < 32) {
     
    19911988                log_msg(3, "Unable to write to %s", bigfile_fname);
    19921989                // So skip it as it doesn't exist
     1990                mr_free(bigfile_fname);
    19931991                continue;
    19941992            } else {
     
    20011999            log_msg(2, "bigfile_fname = %s", bigfile_fname);
    20022000            use_ntfsprog = FALSE;
    2003             if (!strncmp(bigfile_fname, "/dev/", 5)
    2004                 && is_dev_an_NTFS_dev(bigfile_fname)) {
     2001            if (!strncmp(bigfile_fname, "/dev/", 5) && is_dev_an_NTFS_dev(bigfile_fname)) {
    20052002                use_ntfsprog = TRUE;
    20062003                log_msg(2, "Calling ntfsclone in background because %s is an NTFS partition", bigfile_fname);
     
    20102007                switch (pid = fork()) {
    20112008                case -1:
     2009                    mr_free(bigfile_fname);
    20122010                    mr_free(sz_devfile);
    20132011                    fatal_error("Fork failure");
     
    20322030            // Whether partition or biggiefile, just do your thang :-)
    20332031            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2034                 write_header_block_to_stream(biggie_fsize, bigfile_fname,
    2035                                              use_ntfsprog ?
    2036                                              BLK_START_A_PIHBIGGIE :
    2037                                              BLK_START_A_NORMBIGGIE);
     2032                write_header_block_to_stream(biggie_fsize, bigfile_fname, use_ntfsprog ?  BLK_START_A_PIHBIGGIE : BLK_START_A_NORMBIGGIE);
    20382033            }
    20392034            res = slice_up_file_etc(bigfile_fname, ntfsprog_fifo, biggie_file_number, noof_biggie_files, use_ntfsprog);
     
    20422037            }
    20432038            retval += res;
    2044             p = strrchr(bigfile_fname, '/');
    2045             if (p) {
    2046                 p++;
    2047             } else {
    2048                 p = bigfile_fname;
    2049             }
    20502039            mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname);
    20512040            if (res) {
     
    20592048            }
    20602049        }
     2050        mr_free(bigfile_fname);
    20612051#ifndef _XWIN
    20622052        if (!g_text_mode) {
     
    20672057        mr_free(tmp);
    20682058    }
     2059    mr_free(bigfile_fname);
     2060
    20692061    log_msg(1, "Finished backing up bigfiles");
    20702062    log_msg(1, "estimated slices = %ld; actual slices = %ld",
     
    20722064    close_progress_form();
    20732065    paranoid_fclose(fin);
    2074     paranoid_free(bigfile_fname);
    20752066    return (retval);
    20762067}
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2349 r2351  
    313313    /*@ buffers **************************************************** */
    314314    char *program = NULL;
    315     char *incoming;
     315    char *incoming = NULL;
    316316    char *searchstr = NULL;
    317317    char *tmp = NULL;
     
    327327    assert_string_is_neither_NULL_nor_zerolength(drive);
    328328    assert(partno >= 0 && partno < 999);
    329 
    330     malloc_string(incoming);
    331329
    332330#ifdef __FreeBSD__
     
    356354    searchstr = build_partition_name(drive, partno);
    357355    mr_strcat(searchstr, " ");
    358     for (res = 0; !res && fgets(incoming, MAX_STR_LEN - 1, fin);) {
     356    for (res = 0, mr_getline(incoming, fin); !res && !feof(fin) ; mr_getline(incoming, fin)) {
    359357        if (strstr(incoming, searchstr)) {
    360358            res = 1;
    361359        }
    362     }
     360        mr_free(incoming);
     361    }
     362    mr_free(incoming);
    363363    mr_free(searchstr);
    364364
     
    366366        log_OS_error("Cannot pclose fin");
    367367    }
    368     paranoid_free(incoming);
    369368    return (res);
    370369}
     
    567566    /*@ buffers ***************************************************** */
    568567    char *tmp = NULL;
    569     char *tmp1 = NULL;
    570568    char *output = NULL;
    571569    char *cdr_exe = NULL;
     
    634632    }
    635633
    636     malloc_string(tmp);
    637     tmp[0] = '\0';
    638     for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    639          (void)fgets(tmp, MAX_STR_LEN, fin)) {
     634    for (mr_getline(tmp, fin); !feof(fin); mr_getline(tmp, fin)) {
    640635        p = strchr(tmp, '\'');
    641636        if (p) {
     
    657652            }
    658653        }
    659     }
     654        mr_free(tmp);
     655    }
     656    mr_free(tmp);
    660657    paranoid_pclose(fin);
    661658
     
    671668            log_msg(4, "Cannot run 2nd command - non-fatal, fortunately");
    672669        } else {
    673             for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    674                  (void)fgets(tmp, MAX_STR_LEN, fin)) {
     670            for (mr_getline(tmp, fin); !feof(fin); mr_getline(tmp, fin)) {
    675671                log_msg(5, "--> '%s'", tmp);
    676672                if (tmp[0] != ' ' && tmp[1] != ' ') {
     
    688684                    }
    689685                }
     686                mr_free(tmp);
    690687            }
    691688            paranoid_pclose(fin);
     689            mr_free(tmp);
    692690        }
    693691    }
    694692    mr_free(phrase_two);
    695     paranoid_free(tmp);
    696693
    697694#endif
     
    725722
    726723    if (found_it) {
    727         mr_asprintf(tmp1, "grep \"%s=ide-scsi\" " CMDLINE " &> /dev/null", strrchr(output, '/') + 1);
    728         if (system(tmp1) == 0) {
     724        mr_asprintf(tmp, "grep \"%s=ide-scsi\" " CMDLINE " &> /dev/null", strrchr(output, '/') + 1);
     725        if (system(tmp) == 0) {
    729726            log_msg(4, "%s is not right. It's being SCSI-emulated. Continuing.", output);
    730727            found_it = FALSE;
    731728            mr_free(output);
    732729        }
    733         mr_free(tmp1);
     730        mr_free(tmp);
    734731    }
    735732
     
    772769            mr_free(output);
    773770        } else {
    774             mr_asprintf(tmp1, "%s/archives", mountpoint);
     771            mr_asprintf(tmp, "%s/archives", mountpoint);
    775772            if (!does_file_exist(tmp)) {
    776773                log_msg(4, "[Cardigans] I'll take it back");
     
    784781                log_msg(4, "I'm confident the Mondo CD is in %s", output);
    785782            }
    786             mr_free(tmp1);
     783            mr_free(tmp);
    787784        }
    788785    }
     
    808805
    809806    log_msg(1, "command=%s", command);
    810     mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command));
     807    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    811808    mr_free(command);
    812809
    813810    mr_free(output);
    814     if (strlen(tmp1) > 0) {
    815         mr_asprintf(output, "%s", tmp1);
     811    if (strlen(tmp) > 0) {
     812        mr_asprintf(output, "%s", tmp);
    816813        log_msg(4, "Finally found it at %s", output);
    817814    } else {
    818815        log_msg(4, "Still couldn't find it.");
    819816    }
    820     mr_free(tmp1);
     817    mr_free(tmp);
    821818
    822819    return (output);
     
    10261023
    10271024    /*@ buffers ***************************************************** */
    1028     char *incoming;
     1025    char *incoming = NULL;
    10291026    char *device_with_tab = NULL;
    10301027    char *device_with_space = NULL;
     
    10441041    }
    10451042
    1046     malloc_string(incoming);
    10471043    if (device_raw[0] != '/' && !strstr(device_raw, ":/")) {
    10481044        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
     
    10671063        return(FALSE);
    10681064    }
    1069     for ((void)fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    1070          (void)fgets(incoming, MAX_STR_LEN - 1, fin)) {
    1071         if (strstr(incoming, device_with_space) //> incoming
    1072             || strstr(incoming, device_with_tab))   // > incoming)
    1073         {
     1065
     1066    for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) {
     1067        if (strstr(incoming, device_with_space) || strstr(incoming, device_with_tab)) {
    10741068            paranoid_pclose(fin);
    1075             paranoid_free(incoming);
     1069            mr_free(incoming);
    10761070            return(TRUE);
    10771071        }
    1078     }
     1072        mr_free(incoming);
     1073    }
     1074    mr_free(incoming);
    10791075    mr_free(device_with_tab);
    10801076    mr_free(device_with_space);
     
    10861082    }
    10871083    mr_free(tmp);
    1088     paranoid_free(incoming);
    10891084    return(retval);
    10901085}
     
    23082303    char *list_drives_cmd = NULL;
    23092304    char *tmp = NULL;
    2310     char *current_drive;
     2305    char *current_drive = NULL;
    23112306
    23122307    /*@ pointers *************************************************** */
    2313     FILE *pdrives;
     2308    FILE *pdrives = NULL;
    23142309
    23152310    /*@ int ******************************************************** */
     
    23382333    }
    23392334
    2340     malloc_string(current_drive);
    2341     for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    2342          (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
    2343         strip_spaces(current_drive);
     2335    for (mr_getline(current_drive, pdrives); !feof(pdrives); mr_getline(current_drive, pdrives)) {
     2336        mr_strip_spaces(current_drive);
    23442337        log_it("looking at drive %s's MBR", current_drive);
    23452338        if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
     
    23492342            mr_asprintf(which_device, "%s", current_drive);
    23502343            */
     2344            mr_free(current_drive);
    23512345            break;
    23522346        }
     
    23572351            mr_asprintf(which_device, "%s", current_drive);
    23582352            */
     2353            mr_free(current_drive);
    23592354            break;
    23602355        }
    2361     }
     2356        mr_free(current_drive);
     2357    }
     2358    mr_free(current_drive);
     2359
    23622360    if (pclose(pdrives)) {
    23632361        log_OS_error("Cannot pclose pdrives");
     
    23652363    log_it("%d grubs and %d lilos\n", count_grubs, count_lilos);
    23662364    if (count_grubs && !count_lilos) {
    2367         paranoid_free(current_drive);
    23682365        return ('G');
    23692366    } else if (count_lilos && !count_grubs) {
    2370         paranoid_free(current_drive);
    23712367        return ('L');
    23722368    } else if (count_grubs == 1 && count_lilos == 1) {
    23732369        log_it("I'll bet you used to use LILO but switched to GRUB...");
    2374         paranoid_free(current_drive);
    23752370        return ('G');
    23762371    } else {
     
    23822377            log_OS_error("Unable to open list of drives");
    23832378            mr_free(list_drives_cmd);
    2384             paranoid_free(current_drive);
    23852379            return ('\0');
    23862380        }
    23872381        mr_free(list_drives_cmd);
    23882382
    2389         for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    2390             (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
    2391             strip_spaces(current_drive);
     2383        for (mr_getline(current_drive, pdrives); !feof(pdrives); mr_getline(current_drive, pdrives)) {
     2384            mr_strip_spaces(current_drive);
    23922385            log_it("looking at partition %s's BR", current_drive);
    23932386            if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
     
    23972390                mr_asprintf(which_device, "%s", current_drive);
    23982391                */
     2392                mr_free(current_drive);
    23992393                break;
    24002394            }
     
    24052399                mr_asprintf(which_device, "%s", current_drive);
    24062400                */
     2401                mr_free(current_drive);
    24072402                break;
    24082403            }
    2409         }
     2404            mr_free(current_drive);
     2405        }
     2406        mr_free(current_drive);
     2407
    24102408        if (pclose(pdrives)) {
    24112409            log_OS_error("Cannot pclose pdrives");
    24122410        }
    24132411        log_it("%d grubs and %d lilos\n", count_grubs, count_lilos);
    2414         paranoid_free(current_drive);
    24152412        if (count_grubs && !count_lilos) {
    24162413            return ('G');
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2340 r2351  
    414414int call_exe_and_pipe_output_to_fd(char *syscall, FILE * pout)
    415415{
    416     FILE *pattr;
    417     char *tmp;
     416    FILE *pattr = NULL;
     417    char *tmp = NULL;
     418
    418419    pattr = popen(syscall, "r");
    419420    if (!pattr) {
     
    426427        return (2);
    427428    }
    428     malloc_string(tmp);
    429     for ((void)fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr);
    430          (void)fgets(tmp, MAX_STR_LEN, pattr)) {
     429    for (mr_getline(tmp, pattr); !feof(pattr); mr_getline(tmp, pattr)) {
    431430        fputs(tmp, pout);
    432     }
     431        mr_free(tmp);
     432    }
     433    mr_free(tmp);
    433434    paranoid_pclose(pattr);
    434     paranoid_free(tmp);
    435435    return (0);
    436436}
     
    441441                 char *auxlist_fname)
    442442{
    443     FILE *fin;
    444     FILE *pout;
     443    FILE *fin = NULL;
     444    FILE *pout = NULL;
    445445    char *pout_command = NULL;
    446     char *syscall;
    447     char *file_to_analyze;
     446    char *syscall = NULL;
     447    char *file_to_analyze = NULL;
    448448    char *strtmp = NULL;
    449449    char *tmp = NULL;
     
    463463    mr_free(pout_command);
    464464
    465     malloc_string(file_to_analyze);
    466     for ((void)fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin);
    467          (void)fgets(file_to_analyze, MAX_STR_LEN, fin)) {
     465    for (mr_getline(file_to_analyze, fin); !feof(fin); mr_getline(file_to_analyze, fin)) {
    468466        i = strlen(file_to_analyze);
    469467        if (i > 0 && file_to_analyze[i - 1] < 32) {
     
    478476        call_exe_and_pipe_output_to_fd(syscall, pout);
    479477        mr_free(syscall);
    480     }
     478        mr_free(file_to_analyze);
     479    }
     480    mr_free(file_to_analyze);
    481481    paranoid_fclose(fin);
    482482    paranoid_pclose(pout);
    483     paranoid_free(file_to_analyze);
    484483    return (0);
    485484}
     
    529528    char *syscall_pin = NULL;
    530529    char *syscall_pout = NULL;
    531     char *incoming;
    532     char *current_subset_file;
     530    char *incoming = NULL;
     531    char *current_subset_file = NULL;
    533532    char *current_master_file = NULL;
    534533    char *masklist = NULL;
     
    553552        return (0);
    554553    }
    555     malloc_string(incoming);
    556     malloc_string(current_subset_file);
    557554    mr_asprintf(masklist, "%s/masklist", bkpinfo->tmpdir);
    558555    mr_asprintf(command, "cp -f %s %s", orig_msklist, masklist);
     
    561558
    562559    sort_file(masklist);
    563     current_subset_file[0] = '\0';
    564560
    565561    mr_asprintf(syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
     
    594590//  printf("Hi there. Starting the loop\n");
    595591
    596     (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
    597     (void)fgets(incoming, MAX_STR_LEN, pin);
     592    mr_getline(current_subset_file, faclin);
     593    mr_getline(incoming, pin);
    598594    while (!feof(pin) && !feof(faclin)) {
    599595        mr_asprintf(current_master_file, "%s", incoming + 8);
     
    625621        if (i < 0) {            // read another subset file in.
    626622            log_msg(my_depth, "Reading next subset line in\n\n");
    627             (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
     623            mr_free(current_subset_file);
     624            mr_getline(current_subset_file, faclin);
    628625            continue;
    629626        }
     
    632629            fputs(incoming, pout);
    633630        }
    634         (void)fgets(incoming, MAX_STR_LEN, pin);
     631        mr_free(incoming);
     632        mr_getline(incoming, pin);
    635633        if (!i) {
    636634            log_msg(my_depth, "Copying master %s", q);
     
    641639                fputs(incoming, pout);
    642640            }
    643             (void)fgets(incoming, MAX_STR_LEN, pin);
     641            mr_free(incoming);
     642            mr_getline(incoming, pin);
    644643        }
    645644        if (!i) {
    646             (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
     645            mr_free(current_subset_file);
     646            mr_getline(current_subset_file, faclin);
    647647        }
    648648        mr_free(current_master_file);
    649649    }
    650     while (!feof(pin)) {
    651         (void)fgets(incoming, MAX_STR_LEN, pin);
    652     }
     650    mr_free(current_subset_file);
     651    mr_free(incoming);
    653652    fclose(faclin);
    654653    pclose(pin);
    655654    pclose(pout);
    656655
    657 //  printf("OK, loop is done\n");
    658 
    659656    unlink(masklist);
    660657    mr_free(masklist);
    661658
    662     paranoid_free(current_subset_file);
    663     paranoid_free(incoming);
    664659    return (retval);
    665660}
     
    772767    noof_chars = strlen(string_to_add) + 1; /* we include the '\0' */
    773768
    774 /* walk across tree if necessary */
     769    /* walk across tree if necessary */
    775770    node = startnode;
    776771    char_to_add = string_to_add[0];
     
    781776    }
    782777
    783 /* walk down tree if appropriate */
     778    /* walk down tree if appropriate */
    784779    if (node->down != NULL && node->ch == char_to_add) {
    785780        log_msg(7, "depth=%d char=%c --- going DOWN", depth, char_to_add);
     
    795790    }
    796791
    797 /* add here */
     792    /* add here */
    798793    if (!(newnode = (struct s_node *) malloc(sizeof(struct s_node)))) {
    799794        log_to_screen("failed to malloc");
     
    866861    /*@ buffers **************************************************** */
    867862    char *command_to_open_fname = NULL;
    868     char fname[MAX_STR_LEN];
    869     char tmp[MAX_STR_LEN];
    870     char *tmp1 = NULL;
     863    char *fname = NULL;
     864    char *tmp = NULL;
    871865    int pos_in_fname;
    872866    /*@ int ******************************************************** */
     
    884878    }
    885879    log_to_screen("Loading filelist");
    886     mr_asprintf(tmp1, "zcat %s | wc -l", filelist_fname);
    887     log_msg(6, "tmp1 = %s", tmp1);
    888     lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp1));
    889     mr_free(tmp1);
     880    mr_asprintf(tmp, "zcat %s | wc -l", filelist_fname);
     881    log_msg(6, "tmp = %s", tmp);
     882    lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp));
     883    mr_free(tmp);
    890884
    891885    if (lines_in_filelist < 3) {
     
    913907
    914908    open_evalcall_form("Loading filelist from disk");
    915     for ((void)fgets(fname, MAX_STR_LEN, pin); !feof(pin);
    916          (void)fgets(fname, MAX_STR_LEN, pin)) {
    917         if ((fname[strlen(fname) - 1] == 13
    918              || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) {
     909    for (mr_getline(fname, pin); !feof(pin); mr_getline(fname, pin)) {
     910        if ((strlen(fname) > 0) && (fname[strlen(fname) - 1] == 13 || fname[strlen(fname) - 1] == 10)) {
    919911            fname[strlen(fname) - 1] = '\0';
    920912        }
    921 //      strip_spaces (fname);
    922913        if (!strlen(fname)) {
     914            mr_free(fname);
    923915            continue;
    924916        }
     
    927919                continue;
    928920            }
    929             strcpy(tmp, fname);
     921            mr_asprintf(tmp, "%s", fname);
    930922            tmp[pos_in_fname] = '\0';
    931923            if (strlen(tmp)) {
    932924                add_string_at_node(filelist, tmp);
    933925            }
     926            mr_free(tmp);
    934927        }
    935928        add_string_at_node(filelist, fname);
     929        mr_free(fname);
     930
    936931        if (!(++lino % 1111)) {
    937932            percentage = (int) (lino * 100 / lines_in_filelist);
     
    939934        }
    940935    }
     936    mr_free(fname);
     937
    941938    paranoid_pclose(pin);
    942939    close_evalcall_form();
     
    18351832                                  char *list_of_files_fname, bool flag_em)
    18361833{
    1837     FILE *fin;
    1838     char *tmp;
    1839     struct s_node *nod;
    1840 
    1841     malloc_string(tmp);
     1834    FILE *fin = NULL;
     1835    char *tmp = NULL;
     1836    struct s_node *nod = NULL;
     1837
    18421838    log_msg(3, "Adding %s to filelist", list_of_files_fname);
    18431839    if (!(fin = fopen(list_of_files_fname, "r"))) {
     
    18451841        return (1);
    18461842    }
    1847     for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    1848          (void)fgets(tmp, MAX_STR_LEN, fin)) {
     1843    for (mr_getline(tmp, fin); !feof(fin); mr_getline(tmp, fin)) {
    18491844        if (!tmp[0]) {
     1845            mr_free(tmp);
    18501846            continue;
    18511847        }
    1852         if ((tmp[strlen(tmp) - 1] == 13 || tmp[strlen(tmp) - 1] == 10)
    1853             && strlen(tmp) > 0) {
     1848        if ((strlen(tmp) > 0) && (tmp[strlen(tmp) - 1] == 13 || tmp[strlen(tmp) - 1] == 10)) {
    18541849            tmp[strlen(tmp) - 1] = '\0';
    18551850        }
    18561851        log_msg(2, "tmp = '%s'", tmp);
    18571852        if (!tmp[0]) {
     1853            mr_free(tmp);
    18581854            continue;
    18591855        }
     
    18691865            log_msg(5, "Flagged '%s'", tmp);
    18701866        }
    1871     }
     1867        mr_free(tmp);
     1868    }
     1869    mr_free(tmp);
    18721870    paranoid_fclose(fin);
    1873     paranoid_free(tmp);
    18741871    return (0);
    18751872}
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2338 r2351  
    298298
    299299    mr_strcat(mount_isodir_command, " -o ro %s", bkpinfo->isodir);
    300     run_program_and_log_output("df -m", FALSE);
    301     log_msg(1,
    302         "The 'mount' command is '%s'. PLEASE report this command to be if you have problems, ok?",
    303         mount_isodir_command);
     300    run_program_and_log_output("df -m -P", FALSE);
     301    log_msg(1, "The 'mount' command is '%s'. PLEASE report this command to be if you have problems, ok?", mount_isodir_command);
    304302    if (run_program_and_log_output(mount_isodir_command, FALSE)) {
    305303        popup_and_OK
     
    472470 * @return The number of errors encountered (0 for success).
    473471 */
    474 int mount_all_devices(struct mountlist_itself
    475                       *p_external_copy_of_mountlist, bool writeable)
     472int mount_all_devices(struct mountlist_itself *p_external_copy_of_mountlist, bool writeable)
    476473{
    477474int retval = 0, lino, res;
     
    488485
    489486    mvaddstr_and_log_it(g_currentY, 0, "Mounting devices         ");
    490     open_progress_form("Mounting devices",
    491                "I am now mounting all the drives.",
    492                "This should not take long.",
    493                "", mountlist->entries);
     487    open_progress_form("Mounting devices", "I am now mounting all the drives.", "This should not take long.", "", mountlist->entries);
    494488
    495489    mr_asprintf(these_failed, "");
    496490    for (lino = 0; lino < mountlist->entries; lino++) {
    497491        if (!strcmp(mountlist->el[lino].device, "/proc")) {
    498             log_msg(1,
    499                 "Again with the /proc - why is this in your mountlist?");
     492            log_msg(1, "Again with the /proc - why is this in your mountlist?");
    500493        } else if (is_this_device_mounted(mountlist->el[lino].device)) {
    501494            log_to_screen("%s is already mounted", mountlist->el[lino].device);
     
    519512    if (retval) {
    520513        if (g_partition_table_locked_up > 0) {
    521             log_to_screen
    522                 ("fdisk's ictol() call to refresh its copy of the partition table causes the kernel to");
    523             log_to_screen
    524                 ("lock up the partition table. You might have to reboot and use Interactive Mode to");
    525             log_to_screen
    526                 ("format and restore *without* partitioning first. Sorry for the inconvenience.");
     514            log_to_screen("fdisk's ictol() call to refresh its copy of the partition table causes the kernel to");
     515            log_to_screen("lock up the partition table. You might have to reboot and use Interactive Mode to");
     516            log_to_screen("format and restore *without* partitioning first. Sorry for the inconvenience.");
    527517        }
    528518        mr_asprintf(tmp, "Could not mount device(s) %s- shall I abort?", these_failed);
     
    530520        if (!ask_me_yes_or_no(tmp)) {
    531521            retval = 0;
    532             log_to_screen
    533                 ("Continuing, although some device(s) failed to be mounted");
     522            log_to_screen("Continuing, although some device(s) failed to be mounted");
    534523            mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    535524        } else {
    536525            mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    537             log_to_screen
    538         ("Unable to mount some or all of your partitions.");
     526            log_to_screen("Unable to mount some or all of your partitions.");
    539527        }
    540528        mr_free(tmp);
     
    548536    (void)mount_device("/proc","/proc","proc",TRUE);
    549537    (void)mount_device("/sys","/sys","sysfs",TRUE);
    550     run_program_and_log_output("df -m", 3);
     538    run_program_and_log_output("df -m -P", 3);
    551539    paranoid_free(mountlist);
    552540    return (retval);
     
    20362024    sort_mountlist_by_mountpoint(mountlist, 0);
    20372025
    2038     run_program_and_log_output("df -m", 3);
     2026    run_program_and_log_output("df -m -P", 3);
    20392027    mvaddstr_and_log_it(g_currentY, 0, "Unmounting devices      ");
    20402028    open_progress_form("Unmounting devices",
  • branches/2.2.10/tools/myval

    r2340 r2351  
    66sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I "/etc /var/lib/rpm"  -E /etc/init.d -d /home
    77sudo valgrind --log-file=/tmp/valm.log --tool=massif --heap=yes --stacks=yes --alloc-fn=mr_malloc --massif-out-file=/tmp/valm.out /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I "/etc /var/lib/rpm"  -E /etc/init.d -d /home
    8 sudo valgrind --log-file=/tmp/valc.log --tool=callgrind --callgrind-out-file=/tmp/valc.out /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -Y -I "/etc /var/lib/rpm"  -E /etc/init.d -d /home
     8sudo valgrind --log-file=/tmp/valc.log --tool=callgrind --callgrind-out-file=/tmp/valc.out /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -Y -I "/etc /var/lib/rpm"  -T /tmp -S /var/spool/mondo -E /etc/init.d -d /home
Note: See TracChangeset for help on using the changeset viewer.