use readdir_r when available

git-svn: trunk@962
remotes/push_mirror/metadata
Tomasz Kojm 22 years ago
parent 24f501733a
commit 72a1b2408d
  1. 4
      clamav-devel/ChangeLog
  2. 2
      clamav-devel/clamav-config
  3. 6
      clamav-devel/clamav-config.h.in
  4. 9
      clamav-devel/clamd/scanner.c
  5. 145
      clamav-devel/configure
  6. 46
      clamav-devel/configure.in
  7. 9
      clamav-devel/libclamav/others.c
  8. 27
      clamav-devel/libclamav/readdb.c
  9. 18
      clamav-devel/libclamav/scanners.c
  10. 2
      clamav-devel/sigtool/Makefile.in

@ -1,3 +1,7 @@
Sun Oct 3 17:04:27 CEST 2004 (tk)
----------------------------------
* libclamav, clamd: use readdir_r when available
Sat Oct 2 23:02:39 CEST 2004 (tk)
----------------------------------
* configure: improve config file installation (patch by Andrey J. Melnikoff

@ -46,7 +46,7 @@ while test $# -gt 0; do
;;
--version)
echo devel-20041002
echo devel-20041003
exit 0
;;

@ -147,6 +147,12 @@
/* "pragma pack" */
#undef HAVE_PRAGMA_PACK
/* readdir_r takes 2 arguments */
#undef HAVE_READDIR_R_2
/* readdir_r takes 3 arguments */
#undef HAVE_READDIR_R_3
/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H

@ -73,6 +73,9 @@ int dirscan(const char *dirname, const char **virname, unsigned long int *scanne
{
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
struct stat statbuf;
struct cfgstruct *cpt;
char *fname;
@ -93,7 +96,13 @@ int dirscan(const char *dirname, const char **virname, unsigned long int *scanne
}
if((dd = opendir(dirname)) != NULL) {
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
if (!is_fd_connected(odesc)) {
logg("Client disconnected\n");
closedir(dd);

@ -1028,6 +1028,7 @@ Optional Features:
--enable-debug enable debug code
--enable-bigstack increase thread stack size
--disable-gethostbyname_r disable support for gethostbyname_r
--disable-readdir_r disable support for readdir_r
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -5016,7 +5017,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 5019 "configure"' > conftest.$ac_ext
echo '#line 5020 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -5589,7 +5590,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
if { (eval echo configure:5592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
if { (eval echo configure:5593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@ -7516,7 +7517,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7519 "configure"
#line 7520 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -7614,7 +7615,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7617 "configure"
#line 7618 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12719,6 +12720,142 @@ _ACEOF
echo "${ECHO_T}yes, and it takes $ac_cv_gethostbyname_args arguments" >&6
fi
echo "$as_me:$LINENO: checking for readdir_r" >&5
echo $ECHO_N "checking for readdir_r... $ECHO_C" >&6
if test -z "$ac_cv_readdir_args"; then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <dirent.h>
int
main ()
{
struct dirent dir, *dirp;
DIR *mydir;
dirp = readdir_r(mydir, &dir);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_readdir_args=2
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test -z "$ac_cv_readdir_args"; then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <dirent.h>
int
main ()
{
struct dirent dir, *dirp;
DIR *mydir;
int rc;
rc = readdir_r(mydir, &dir, &dirp);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_readdir_args=3
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
# Check whether --enable-readdir_r or --disable-readdir_r was given.
if test "${enable_readdir_r+set}" = set; then
enableval="$enable_readdir_r"
ac_cv_readdir_args=""
fi;
if test -z "$ac_cv_readdir_args"; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
else
if test "$ac_cv_readdir_args" = 2; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_READDIR_R_2 1
_ACEOF
elif test "$ac_cv_readdir_args" = 3; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_READDIR_R_3 1
_ACEOF
fi
echo "$as_me:$LINENO: result: yes, and it takes $ac_cv_readdir_args arguments" >&5
echo "${ECHO_T}yes, and it takes $ac_cv_readdir_args arguments" >&6
fi
if test "$test_clamav" = "yes"
then
if test "$use_id" = "no"

@ -1,5 +1,6 @@
dnl
dnl Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
dnl gethostbyname_r and readdir_r checks (c) COPYRIGHT MIT 1995
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@ -580,6 +581,51 @@ else
AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyname_args arguments])
fi
dnl Check for readdir_r and number of its arguments
dnl Code from libwww/configure.in
AC_MSG_CHECKING(for readdir_r)
if test -z "$ac_cv_readdir_args"; then
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <dirent.h>
],
[
struct dirent dir, *dirp;
DIR *mydir;
dirp = readdir_r(mydir, &dir);
], ac_cv_readdir_args=2)
fi
if test -z "$ac_cv_readdir_args"; then
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <dirent.h>
],
[
struct dirent dir, *dirp;
DIR *mydir;
int rc;
rc = readdir_r(mydir, &dir, &dirp);
], ac_cv_readdir_args=3)
fi
AC_ARG_ENABLE(readdir_r,
[ --disable-readdir_r disable support for readdir_r],
ac_cv_readdir_args="",)
if test -z "$ac_cv_readdir_args"; then
AC_MSG_RESULT(no)
else
if test "$ac_cv_readdir_args" = 2; then
AC_DEFINE(HAVE_READDIR_R_2,1,[readdir_r takes 2 arguments])
elif test "$ac_cv_readdir_args" = 3; then
AC_DEFINE(HAVE_READDIR_R_3,1,[readdir_r takes 3 arguments])
fi
AC_MSG_RESULT([yes, and it takes $ac_cv_readdir_args arguments])
fi
dnl Check for clamav in /etc/passwd
if test "$test_clamav" = "yes"
then

@ -359,6 +359,9 @@ int cli_rmdirs(const char *dirname)
{
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
struct stat maind, statbuf;
char *fname;
@ -371,7 +374,13 @@ int cli_rmdirs(const char *dirname)
while(stat(dirname, &maind) != -1) {
if(!rmdir(dirname)) break;
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
#ifndef C_INTERIX
if(dent->d_ino)
#endif

@ -690,6 +690,9 @@ int cl_loaddbdir(const char *dirname, struct cl_node **root, unsigned int *signo
{
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
char *dbfile;
int ret;
@ -701,7 +704,13 @@ int cl_loaddbdir(const char *dirname, struct cl_node **root, unsigned int *signo
cli_dbgmsg("Loading databases from %s\n", dirname);
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
#ifndef C_INTERIX
if(dent->d_ino)
#endif
@ -746,6 +755,9 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
{
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
char *fname;
@ -765,7 +777,13 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
cli_dbgmsg("Stat()ing files in %s\n", dirname);
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
#ifndef C_INTERIX
if(dent->d_ino)
#endif
@ -796,6 +814,9 @@ int cl_statchkdir(const struct cl_stat *dbstat)
{
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
struct stat sb;
int i, found;
char *fname;
@ -813,7 +834,13 @@ int cl_statchkdir(const struct cl_stat *dbstat)
cli_dbgmsg("Stat()ing files in %s\n", dbstat->dir);
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
#ifndef C_INTERIX
if(dent->d_ino)
#endif

@ -739,12 +739,21 @@ static int cli_scandir(const char *dirname, const char **virname, long int *scan
{
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
struct stat statbuf;
char *fname;
if((dd = opendir(dirname)) != NULL) {
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
#ifndef C_INTERIX
if(dent->d_ino)
#endif
@ -790,6 +799,9 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
vba_project_t *vba_project;
DIR *dd;
struct dirent *dent;
#if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
struct dirent result;
#endif
struct stat statbuf;
char *fname, *fullname;
unsigned char *data;
@ -879,7 +891,13 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
return ret;
if((dd = opendir(dirname)) != NULL) {
#ifdef HAVE_READDIR_R_3
while(!readdir_r(dd, &result, &dent) && dent) {
#elif defined(HAVE_READDIR_R_2)
while((dent = (struct dirent *) readdir_r(dd, &result))) {
#else
while((dent = readdir(dd))) {
#endif
#ifndef C_INTERIX
if(dent->d_ino)
#endif

@ -58,7 +58,7 @@ host_triplet = @host@
target_triplet = @target@
bin_PROGRAMS = sigtool$(EXEEXT)
subdir = sigtool
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in

Loading…
Cancel
Save