Custom Query (467 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (19 - 21 of 467)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Ticket Resolution Summary Owner Reporter
#454 fixed memory leak in version 4.4.4 rainer rainer
Description

The scandir() function allocates memory which the code introduced in 4.4.4 does not free().

#453 fixed configure does not recognize invalid negative compiler options rainer rainer
Description

The configure script does not correctly recognize invalid negative compiler options (of the form -Wno-invalid-option).

The reason is that gcc never throws an error for invalid negative options, thus need to check always for the positive form of the option.

#452 fixed reproducible database generation rainer rainer
Description

There has been a request (and patch) by K. Hacene for reproducible database generation, by means of initializing unused fields and using scandir() instead of readdir() for alphanumeric sorting:

 ---
 src/sh_dbIO.c  |  2 ++
 src/sh_files.c | 14 ++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/sh_dbIO.c b/src/sh_dbIO.c
index fbe4229..5ff1908 100644
--- a/src/sh_dbIO.c
+++ b/src/sh_dbIO.c
@@ -1408,6 +1408,8 @@ static void sh_dbIO_data_write_int (file_type * buf, char * fileHash,
 
   SL_ENTER(_("sh_dbIO_data_write_int"));
 
+  memset(&p, 0, sizeof(sh_filestore_t));
+
   do_writeout_checks(outpath);
 
   if (sh.flag.update == S_FALSE)
diff --git a/src/sh_files.c b/src/sh_files.c
index 8475208..13690d5 100644
--- a/src/sh_files.c
+++ b/src/sh_files.c
@@ -19,7 +19,9 @@
 
 #include "config_xor.h"
 
-#if defined(HAVE_PTHREAD_MUTEX_RECURSIVE)
+#if defined(HAVE_PTHREAD_MUTEX_RECURSIVE) && defined(HAVE_DIRENT_H)
+#define _XOPEN_SOURCE 700
+#elif defined(HAVE_PTHREAD_MUTEX_RECURSIVE)
 #define _XOPEN_SOURCE 500
 #endif
 
@@ -2091,6 +2093,8 @@ int sh_files_checkdir (int iclass, unsigned long check_flags,
 
   DIR *           thisDir = NULL;
   struct dirent * thisEntry;
+  struct dirent **entryList;
+  int             entry;
   int             status;
   int             dummy = S_FALSE;
   dir_type      * theDir;
@@ -2277,8 +2281,10 @@ int sh_files_checkdir (int iclass, unsigned long check_flags,
   dirlist = NULL;
   dirlist_orig = NULL;
 
-  do {
-      thisEntry = readdir (thisDir);
+  entry = scandir(iname, &entryList, 0, alphasort);
+  while(entry--)
+  {
+    thisEntry = entryList[entry];
       if (thisEntry != NULL) 
 	{
 	  ++theDir->NumAll;
@@ -2294,7 +2300,7 @@ int sh_files_checkdir (int iclass, unsigned long check_flags,
 	    }
 	  dirlist = addto_sh_dirlist (thisEntry, dirlist);
 	}
-  } while (thisEntry != NULL);
+  }
 
   SH_MUTEX_UNLOCK(mutex_readdir);
 
-- 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Batch Modify
Note: See TracBatchModify for help on using batch modify.
Note: See TracQuery for help on using queries.