Changeset 131 for trunk/src/sh_files.c
- Timestamp:
- Oct 22, 2007, 11:19:15 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_files.c
r114 r131 60 60 #if (defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)) 61 61 62 #include "sh_pthread.h" 62 63 #include "sh_error.h" 63 64 #include "sh_utils.h" … … 191 192 SL_RETURN((0), _("sh_files_setrecursion")); 192 193 } 193 194 194 195 195 unsigned long sh_files_chk () … … 1340 1340 } 1341 1341 1342 /** 1342 1343 struct sh_dirent { 1343 /* char sh_d_name[NAME_MAX + 2]; */1344 1344 char * sh_d_name; 1345 1345 struct sh_dirent * next; 1346 1346 }; 1347 1348 static void kill_sh_dirlist (struct sh_dirent * dirlist) 1347 **/ 1348 1349 void kill_sh_dirlist (struct sh_dirent * dirlist) 1349 1350 { 1350 1351 struct sh_dirent * this; … … 1362 1363 /* -- add an entry to a directory listing 1363 1364 */ 1364 st atic struct sh_dirent * addto_sh_dirlist (struct dirent * thisEntry,1365 1365 struct sh_dirent * addto_sh_dirlist (struct dirent * thisEntry, 1366 struct sh_dirent * dirlist) 1366 1367 { 1367 1368 struct sh_dirent * this; … … 1485 1486 dir_type theDir; 1486 1487 ShFileType checkit; 1487 1488 static unsigned int state = 1; 1488 1489 1489 1490 file_type theFile; … … 1633 1634 /* ---- read ---- 1634 1635 */ 1636 SH_MUTEX_LOCK(readdir_lock); 1637 1635 1638 do { 1636 1639 thisEntry = readdir (thisDir); … … 1652 1655 } while (thisEntry != NULL); 1653 1656 1657 SH_MUTEX_UNLOCK(readdir_lock); 1658 1654 1659 closedir (thisDir); 1655 1660 … … 1672 1677 1673 1678 BREAKEXIT(sh_derr); 1674 if (0 == (rand() % 5)) 1675 (void) sh_derr(); 1679 1680 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_RAND_R) 1681 if (0 == (rand_r(&state) % 5)) (void) sh_derr(); 1682 #else 1683 if (0 == state * (rand() % 5)) (void) sh_derr(); 1684 #endif 1676 1685 1677 1686 /* ---- Check the file. ---- … … 1929 1938 char * fileName; 1930 1939 struct utimbuf utime_buf; 1940 static unsigned int state = 1; 1931 1941 1932 1942 SL_ENTER(_("sh_files_filecheck")); 1933 1943 1934 1944 BREAKEXIT(sh_derr); 1935 if (0 == (rand() % 2)) 1936 (void) sh_derr(); 1945 1946 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_RAND_R) 1947 if (0 == (rand_r(&state) % 2)) (void) sh_derr(); 1948 #else 1949 if (0 == state * (rand() % 2)) (void) sh_derr(); 1950 #endif 1937 1951 1938 1952 if (dirName && infileName && (dirName[0] == '/') && (dirName[1] == '\0')
Note:
See TracChangeset
for help on using the changeset viewer.