Show
Ignore:
Timestamp:
06/18/10 20:02:50 (3 years ago)
Author:
nlmills
Message:

initial merge with Orange-Branch. much will be broken

Location:
branches/cu-security-branch
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/cu-security-branch

    • Property svn:ignore
      •  

        old new  
        33aclocal.m4 
        44autom4te.cache 
        5 config.status 
        6 Makefile 
        7 pvfs2-config.h 
        8 module.mk 
  • branches/cu-security-branch/src/common/misc

    • Property svn:ignore deleted
  • branches/cu-security-branch/src/common/misc/str-utils.c

    r8330 r8397  
    144144 
    145145    /* initialize our starting position */ 
    146     if (*inout_segp == NULL) { 
    147         ptr = pathname; 
    148     } 
    149     else if (*opaquep != NULL) { 
    150         /* replace the '/', point just past it */ 
    151         ptr = (char *) *opaquep; 
    152         *ptr = '/'; 
    153         ptr++; 
    154     } 
    155     else return -1; /* NULL *opaquep indicates last segment returned last time */ 
     146    if (*inout_segp == NULL) 
     147    { 
     148        ptr = pathname; 
     149    } 
     150    else if (*opaquep != NULL) 
     151    { 
     152        /* replace the '/', point just past it */ 
     153        ptr = (char *) *opaquep; 
     154        *ptr = '/'; 
     155        ptr++; 
     156    } 
     157    else 
     158        return -1; /* NULL *opaquep indicates last segment returned last time */ 
    156159 
    157160    /* at this point, the string is back in its original state */ 
    158161 
    159162    /* jump past separators */ 
    160     while ((*ptr != '\0') && (*ptr == '/')) ptr++; 
    161     if (*ptr == '\0') return -1; /* all that was left was trailing '/'s */ 
     163    while ((*ptr != '\0') && (*ptr == '/')) 
     164        ptr++; 
     165    if (*ptr == '\0') 
     166        return -1; /* all that was left was trailing '/'s */ 
    162167 
    163168    *inout_segp = ptr; 
    164169 
    165170    /* find next separator */ 
    166     while ((*ptr != '\0') && (*ptr != '/')) ptr++; 
    167     if (*ptr == '\0') *opaquep = NULL; /* indicate last segment */ 
    168     else { 
    169         /* terminate segment and save position of terminator */ 
    170         *ptr = '\0'; 
    171         *opaquep = ptr; 
     171    while ((*ptr != '\0') && (*ptr != '/')) 
     172        ptr++; 
     173    if (*ptr == '\0') 
     174        *opaquep = NULL; /* indicate last segment */ 
     175    else 
     176    { 
     177        /* terminate segment and save position of terminator */ 
     178        *ptr = '\0'; 
     179        *opaquep = ptr; 
    172180    } 
    173181    return 0; 
     
    312320    for(i =0; i < pathlen; i++) 
    313321    { 
    314         if (path[i] == '/') 
    315         { 
    316             num_slashes_seen++; 
    317             if (num_slashes_seen > skip) 
    318             { 
    319                 break; 
    320             } 
    321         } 
     322        if (path[i] == '/') 
     323        { 
     324                 num_slashes_seen++; 
     325            if (num_slashes_seen > skip) 
     326            { 
     327                break; 
     328            } 
     329        } 
    322330    } 
    323331 
     
    356364    if (!comma_list || !tokens) 
    357365    { 
    358         return (0); 
     366        return (0); 
    359367    } 
    360368 
     
    363371    while ((holder = index(holder, ','))) 
    364372    { 
    365         tokencount++; 
    366         holder++; 
     373        tokencount++; 
     374        holder++; 
    367375    } 
    368376 
     
    380388    if (!(*tokens)) 
    381389    { 
    382         return 0; 
     390        return 0; 
    383391    } 
    384392 
    385393    if(1 == tokencount) 
    386394    { 
    387         (*tokens)[0] = strdup(comma_list); 
    388         if(!(*tokens)[0]) 
    389         { 
    390             tokencount = 0; 
    391             goto failure; 
    392         } 
    393         return tokencount; 
     395        (*tokens)[0] = strdup(comma_list); 
     396        if(!(*tokens)[0]) 
     397        { 
     398            tokencount = 0; 
     399            goto failure; 
     400        } 
     401        return tokencount; 
    394402    } 
    395403 
     
    399407    for (i = 0; i < tokencount && holder; i++) 
    400408    { 
    401         holder2 = index(holder, ','); 
    402         if (!holder2) 
    403         { 
    404             holder2 = end; 
    405         } 
     409        holder2 = index(holder, ','); 
     410        if (!holder2) 
     411        { 
     412            holder2 = end; 
     413        } 
    406414        if (holder2 - holder == 0) { 
    407415            retval--; 
    408             goto out; 
    409         } 
    410         (*tokens)[i] = (char *) malloc((holder2 - holder) + 1); 
    411         if (!(*tokens)[i]) 
    412         { 
    413             goto failure; 
    414         } 
    415         strncpy((*tokens)[i], holder, (holder2 - holder)); 
    416         (*tokens)[i][(holder2 - holder)] = '\0'; 
     416            return (retval); 
     417        } 
     418        (*tokens)[i] = (char *) malloc((holder2 - holder) + 1); 
     419        if (!(*tokens)[i]) 
     420        { 
     421            goto failure; 
     422        } 
     423        strncpy((*tokens)[i], holder, (holder2 - holder)); 
     424        (*tokens)[i][(holder2 - holder)] = '\0'; 
    417425        assert(strlen((*tokens)[i]) != 0); 
    418         holder = holder2 + 1; 
    419     } 
    420  
    421 out: 
     426        holder = holder2 + 1; 
     427    } 
     428 
    422429    return (retval); 
    423430 
    424   failure: 
     431failure: 
    425432 
    426433    /* free up any memory we allocated if we failed */ 
    427434    if (*tokens) 
    428435    { 
    429         for (i = 0; i < tokencount; i++) 
    430         { 
    431             if ((*tokens)[i]) 
    432             { 
    433                 free((*tokens)[i]); 
    434             } 
    435         } 
    436         free(*tokens); 
     436        for (i = 0; i < tokencount; i++) 
     437        { 
     438            if ((*tokens)[i]) 
     439            { 
     440                free((*tokens)[i]); 
     441            } 
     442        } 
     443        free(*tokens); 
    437444    } 
    438445    return (0);