Changeset 5149

Show
Ignore:
Timestamp:
01/05/08 01:01:06 (1 year ago)
Author:
morris
Message:

Use readdir_r() for thread safety

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libwired/trunk/libwired/file/wi-fts.c

    r4437 r5149  
    571571 
    572572static WI_FTSENT * wi_fts_build(WI_FTS *sp, int type) { 
    573         struct dirent *dp; 
     573        struct dirent de, *dp; 
    574574        WI_FTSENT *p, *head; 
    575575        WI_FTSENT *cur, *tail; 
     
    665665        /* Read the directory, attaching each entry to the `link' pointer. */ 
    666666        doadjust = 0; 
    667         for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) { 
     667        for (head = tail = NULL, nitems = 0; dirp && (readdir_r(dirp, &de, &dp) == 0 && dp);) { 
    668668                if (!ISSET(WI_FTS_SEEDOT) && ISDOT(dp->d_name)) 
    669669                        continue;