Diff
Not logged in

Differences From Artifact [3c1db83fe0]:

To Artifact [561030550d]:


799
800
801
802
803
804
805
806

807
808
809
810
811





812
813

814
815
816
817
818
819





820
821
822



823
824
825
826
827
828
829
799
800
801
802
803
804
805

806
807
808



809
810
811
812
813
814

815
816





817
818
819
820
821
822


823
824
825
826
827
828
829
830
831
832







-
+


-
-
-
+
+
+
+
+

-
+

-
-
-
-
-
+
+
+
+
+

-
-
+
+
+







TclpReaddir(DIR * dir)
{
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
    Tcl_DirEntry *ent;

#ifdef HAVE_READDIR_R
    ent = &tsdPtr->rdbuf.ent; 
    if (Tcl_PlatformReaddir_r(dir, ent, &ent) != 0) {
    if (TclOSreaddir_r(dir, ent, &ent) != 0) {
	ent = NULL;
    }
#else
    Tcl_MutexLock( &rdMutex );
#ifdef HAVE_STRUCT_DIRENT64

#else /* !HAVE_READDIR_R */

    Tcl_MutexLock(&rdMutex);
#   ifdef HAVE_STRUCT_DIRENT64
    ent = readdir64(dir);
#else
#   else /* !HAVE_STRUCT_DIRENT64 */
    ent = readdir(dir);
#endif
    if(ent != NULL) {
    	memcpy( (VOID *) &tsdPtr->rdbuf.ent, (VOID *) ent,
    		sizeof (Tcl_DirEntry) + sizeof (char) * (PATH_MAX+1) );
    	ent = &tsdPtr->rdbuf.ent;     
#   endif /* HAVE_STRUCT_DIRENT64 */
    if (ent != NULL) {
	memcpy((VOID *) &tsdPtr->rdbuf.ent, (VOID *) ent,
		sizeof(Tcl_DirEntry) + sizeof(char) * (PATH_MAX+1));
	ent = &tsdPtr->rdbuf.ent;
    }
    Tcl_MutexUnlock( &rdMutex );
#endif
    Tcl_MutexUnlock(&rdMutex);

#endif /* HAVE_READDIR_R */
    return ent;
}

#if !defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)
TCL_DECLARE_MUTEX( tmMutex )
#undef localtime
#undef gmtime