- Timestamp:
- Jun 30, 2021, 10:29:32 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_dbIO.c
r560 r564 1512 1512 } 1513 1513 } 1514 1515 if (!buf) { 1516 memset(&p, 0, sizeof(sh_filestore_t)); 1517 } 1514 1515 /* unconditionally initialize the structure */ 1516 memset(&p, 0, sizeof(sh_filestore_t)); 1518 1517 1519 1518 if (buf != NULL) -
trunk/src/sh_files.c
r543 r564 20 20 #include "config_xor.h" 21 21 22 #if defined(HAVE_PTHREAD_MUTEX_RECURSIVE) 22 #if defined(HAVE_PTHREAD_MUTEX_RECURSIVE) && defined(HAVE_DIRENT_H) && defined(HAVE_SCANDIR) 23 24 /* Linux */ 25 #if defined(__linux__) 26 #define _XOPEN_SOURCE 700 27 #define SH_USE_SCANDIR 1 28 29 /* FreeBSD */ 30 #elif defined(__FreeBSD__) 31 32 #if __FreeBSD__ >= 8 33 #define __XSI_VISIBLE 700 34 #define SH_USE_SCANDIR 1 35 #endif 36 37 /* OpenBSD */ 38 #elif defined(__OpenBSD__) 39 #define __POSIX_VISIBLE 200809 40 #define SH_USE_SCANDIR 1 41 42 #elif defined(__NetBSD__) 43 #define _NETBSD_SOURCE 44 #define SH_USE_SCANDIR 1 45 46 /* other os */ 47 #else 48 #define _XOPEN_SOURCE 500 49 50 #endif 51 52 #elif defined(HAVE_PTHREAD_MUTEX_RECURSIVE) 23 53 #define _XOPEN_SOURCE 500 24 54 #endif … … 36 66 #include <sys/types.h> 37 67 #include <unistd.h> 38 #include <sys/types.h>39 68 #include <sys/stat.h> 40 69 #include <fcntl.h> … … 2081 2110 DIR * thisDir = NULL; 2082 2111 struct dirent * thisEntry; 2112 #if defined(SH_USE_SCANDIR) 2113 struct dirent **entryList; 2114 int entry; 2115 #endif 2083 2116 int status; 2084 2117 int dummy = S_FALSE; … … 2267 2300 dirlist_orig = NULL; 2268 2301 2302 #if defined(SH_USE_SCANDIR) 2303 entry = scandir(iname, &entryList, 0, alphasort); 2304 while(entry > 0) { /* scandir() may return -1 on error! */ 2305 entry--; 2306 thisEntry = entryList[entry]; 2307 #else 2269 2308 do { 2270 2309 thisEntry = readdir (thisDir); 2310 #endif 2271 2311 if (thisEntry != NULL) 2272 2312 { … … 2284 2324 dirlist = addto_sh_dirlist (thisEntry, dirlist); 2285 2325 } 2286 } while (thisEntry != NULL); 2287 2326 } 2327 #if !defined(SH_USE_SCANDIR) 2328 while (thisEntry != NULL); 2329 #endif 2330 2288 2331 SH_MUTEX_UNLOCK(mutex_readdir); 2289 2332
Note:
See TracChangeset
for help on using the changeset viewer.