[syslog-ng]crashbug fix in recent syslog-ng versions

Balazs Scheidler bazsi@balabit.hu
Wed, 30 Oct 2002 14:44:30 +0100


On Tue, Oct 29, 2002 at 02:38:11PM -0500, Hamilton, Andrew wrote:
> Well with a couple of changes I got it to work correctly on Solaris 8 x86.
> I ran configure a bunch of times with various corrections to configure.in
> because I originally got the HAVE_RES_INIT problem like the others did.
> Then of course the link problem with -lresolv came up during the compile.
> But I used the patch that Andrey sent for acconfig.h then I added a line to
> configure.in and voila! it worked perfectly for me "out of the box" so to
> speak.
> 
> *** configure.in.orig   Tue Oct 29 20:00:52 2002
> --- configure.in        Tue Oct 29 20:20:34 2002
> ***************                                 
> *** 151,156 ****                                
> --- 151,157 ----                                
>                                                 
>   if test "x$blb_cv_c_res_init" = "xyes"; then  
>         AC_DEFINE(HAVE_RES_INIT)                
> +       LIBS="$LIBS -lresolv"                   
>   fi                                            
>                                                 
>   dnl Checks for library functions.
> 
> That's all it took.  This may work for some others that are having the
> -lresolv link error.  I saw where it looked like it was checking for
> res_init twice, once it said yes then the next time it said no, I think what
> it is doing the first time it is looking for the function definition inside
> the header and the next time it is looking inside libresolv because when the
> line above was added it said "yes" both times instead of "no" the second
> time.

I'd rather add an AC_CHECK_LIB() function. Here's a diff against the
configure.in found in 1.5.23, can you check if this is ok?

diff -u -r1.59 configure.in
--- configure.in	28 Oct 2002 08:52:51 -0000	1.59
+++ configure.in	30 Oct 2002 13:43:50 -0000
@@ -146,7 +146,7 @@
 	AC_DEFINE(HAVE_O_LARGEFILE, 1)
 fi
 
-AC_CACHE_CHECK(for res_init, blb_cv_c_res_init,
+AC_CACHE_CHECK(for res_init in <resolv.h>, blb_cv_c_res_init,
   [AC_EGREP_HEADER(res_init, resolv.h, blb_cv_c_res_init=yes)])
 
 if test "x$blb_cv_c_res_init" = "xyes"; then
@@ -156,9 +156,11 @@
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
 AC_FUNC_VPRINTF
+AC_CHECK_LIB(resolv, res_init)
+dnl on Linux res_init is a macro
+AC_CHECK_LIB(resolv, __res_init)
 AC_CHECK_LIB(door, door_create)
 AC_CHECK_FUNCS(select snprintf vsnprintf strerror inet_aton strncpy getutent)
-AC_CHECK_FUNCS(res_init)
 AC_CHECK_FUNC(getopt_long,,[LIBOBJS="getopt.o getopt1.o $LIBOBJS"])
 AC_CHECK_FUNC(strcasecmp,,[LIBOBJS="strcasecmp.o $LIBOBJS"])
 AC_CHECK_FUNC(strptime,,[LIBOBJS="strptime.o $LIBOBJS"])


-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1