Changeset 2473 in MondoRescue


Ignore:
Timestamp:
Nov 10, 2009, 2:13:10 PM (14 years ago)
Author:
Bruno Cornec
Message:
  • Fix #363 where exclude_paths was extended up to memory limit dumping core
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2472 r2473  
    19461946char *mounted_on_dsf = NULL;
    19471947char *not_mounted_on_dsf = NULL;
    1948 char token_chars[] =" \t\r\f\a\0";
     1948char token_chars[] =" \t\r\f\a\0\n";
    19491949
    19501950while ((token = mr_strtok(pathlist, token_chars, &lastpos)) != NULL) {
     
    19651965                log_to_screen("  %s\n", mounted_on_dsf);
    19661966                log_msg (5, "Adding to bkpinfo->exclude_paths due to -E option: %s", mounted_on_dsf);
     1967                strcat(bkpinfo->exclude_paths, " ");
    19671968                strcat(bkpinfo->exclude_paths, mounted_on_dsf);
    19681969                strcat(bkpinfo->exclude_paths, " ");
     
    19771978                log_to_screen("Not archiving the following file systems:\n");
    19781979                log_to_screen("  %s\n", not_mounted_on_dsf);
     1980                strcat(bkpinfo->exclude_paths, " ");
    19791981                strcat(bkpinfo->exclude_paths, not_mounted_on_dsf);
    19801982                strcat(bkpinfo->exclude_paths, "");
     
    19891991    case -1:
    19901992        if (mode == 'E') {
    1991             strcat(bkpinfo->exclude_paths, token);
    1992             strcat(bkpinfo->exclude_paths, " ");
     1993            /*  Add the token if not already in the list */
     1994            if (strstr(bkpinfo->exclude_paths,token) == NULL) {
     1995                strcat(bkpinfo->exclude_paths, " ");
     1996                strcat(bkpinfo->exclude_paths, token);
     1997                strcat(bkpinfo->exclude_paths, " ");
     1998            }
    19931999        } else {
    1994             strcat(bkpinfo->include_paths, token);
    1995             strcat(bkpinfo->include_paths, " ");
     2000            /*  Add the token if not already in the list */
     2001            if (strstr(bkpinfo->include_paths,token) == NULL) {
     2002                strcat(bkpinfo->include_paths, " ");
     2003                strcat(bkpinfo->include_paths, token);
     2004                strcat(bkpinfo->include_paths, " ");
     2005            }
    19962006        }
    19972007        break;
     
    26362646    log_it("prefix = %s", bkpinfo->prefix);
    26372647    log_it("compression = %ld", bkpinfo->compression_level);
     2648    log_it("exclude_path = %s", bkpinfo->exclude_paths);
     2649    log_it("include_path = %s", bkpinfo->include_paths);
    26382650
    26392651    /* Handle devices passed in bkpinfo and print result */
    2640     mr_make_devlist_from_pathlist(bkpinfo->exclude_paths, 'E');
    2641     mr_make_devlist_from_pathlist(bkpinfo->include_paths, 'I');
     2652    /*  the mr_make_devlist_from_pathlist function appends
     2653     *  to the *_paths variables so copy before */
     2654    mr_asprintf(&tmp, "%s ", bkpinfo->exclude_paths);
     2655    mr_make_devlist_from_pathlist(tmp, 'E');
     2656    mr_free(tmp);
     2657    mr_asprintf(&tmp, "%s ", bkpinfo->include_paths);
     2658    mr_make_devlist_from_pathlist(tmp, 'I');
     2659    mr_free(tmp);
    26422660
    26432661    log_it("scratchdir = '%s'", bkpinfo->scratchdir);
Note: See TracChangeset for help on using the changeset viewer.