Changeset 2525


Ignore:
Timestamp:
Jan 7, 2010, 5:45:43 PM (10 years ago)
Author:
bruno
Message:

r3732@localhost: bruno | 2010-01-07 13:25:24 +0100

  • Fix #381 by postfixing spaces at the end of the strings to be cheked in strstr
File:
1 edited

Legend:

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

    r2501 r2525  
    19471947char *not_mounted_on_dsf = NULL;
    19481948char token_chars[] =" \t\r\f\a\0\n";
     1949char *tmp = NULL;
     1950char *tmp1 = NULL;
    19491951
    19501952while ((token = mr_strtok(pathlist, token_chars, &lastpos)) != NULL) {
     
    19901992    /* A device special file was not passed in. Process it as a path. */
    19911993    case -1:
     1994        /* we need to add a space after token to be sure our strstr test works correctly */
     1995        mr_asprintf(&tmp1,"%s ",token);
    19921996        if (mode == 'E') {
    19931997            /*  Add the token if not already in the list */
    1994             if (strstr(bkpinfo->exclude_paths,token) == NULL) {
     1998            mr_asprintf(&tmp,"%s ",bkpinfo->exclude_paths);
     1999            if (strstr(tmp,tmp1) == NULL) {
    19952000                strcat(bkpinfo->exclude_paths, " ");
    1996                 strcat(bkpinfo->exclude_paths, token);
    1997                 strcat(bkpinfo->exclude_paths, " ");
     2001                strcat(bkpinfo->exclude_paths, tmp1);
    19982002            }
    19992003        } else {
    20002004            /*  Add the token if not already in the list */
    2001             if (strstr(bkpinfo->include_paths,token) == NULL) {
     2005            mr_asprintf(&tmp,"%s ",bkpinfo->include_paths);
     2006            if (strstr(tmp,tmp1) == NULL) {
    20022007                strcat(bkpinfo->include_paths, " ");
    2003                 strcat(bkpinfo->include_paths, token);
    2004                 strcat(bkpinfo->include_paths, " ");
    2005             }
    2006         }
     2008                strcat(bkpinfo->include_paths, tmp1);
     2009            }
     2010        }
     2011        mr_free(tmp);
     2012        mr_free(tmp1);
    20072013        break;
    20082014    }
Note: See TracChangeset for help on using the changeset viewer.