*** FileNom.c	Mon Feb 27 15:03:49 1995
--- FileNom.sol.c	Mon Feb 27 14:49:42 1995
***************
*** 844,858 ****
         /* Read the directory a first time, to get              */
         /* the number `num' of entries and to allocate namedir. */
         num = 0;
!        while ( (direntp = readdir(dirp)) != NULL ) num++;
         namelist = (struct dirent **)XtMalloc( (num+1)*sizeof(struct dirent *));
         num = 0;
         rewinddir( dirp );
         while ( TRUE ) {
! 	 if ( (direntp = readdir(dirp)) == NULL ) break;
! 	 namelist[num] = (struct dirent *) XtMalloc(direntp_size);
! 	 bcopy(direntp, namelist[num], direntp_size);
! 	 num++;
  	 direntp = (struct dirent *)XtMalloc( direntp_size );
         }
         XtFree( (char *)direntp );
--- 844,856 ----
         /* Read the directory a first time, to get              */
         /* the number `num' of entries and to allocate namedir. */
         num = 0;
!        while ( readdir_r( dirp, direntp) != NULL ) num++;
         namelist = (struct dirent **)XtMalloc( (num+1)*sizeof(struct dirent *));
         num = 0;
         rewinddir( dirp );
         while ( TRUE ) {
! 	 if ( readdir_r(dirp, direntp ) == NULL ) break;
! 	 namelist[num] = direntp;
  	 direntp = (struct dirent *)XtMalloc( direntp_size );
         }
         XtFree( (char *)direntp );
