Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes: > The compiler warning is bogus. Your patch pessimizes the code; IIRC it > can cause runtime-initialization of the pointer. > > OK to commit a patch to change this to strlen.
Like so? (apologies in advance: gmane will probably botch the patch due to long lines) > Even better to post a > GCC patch to avoid emitting this warning. I have no idea where to patch that, but I guess I could go ahead and submit the bug report. From: Eric Blake <e...@byu.net> Date: Mon, 2 Nov 2009 11:58:28 -0700 Subject: [PATCH] Allow gcc builds with -Wall -Werror. * libltdl/ltdl.c (try_dlopen): Use strlen rather than LT_STRLEN on an array that will never be NULL. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 6 ++++++ libltdl/ltdl.c | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index caf125a..057f9a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-02 Eric Blake <e...@byu.net> + + Allow gcc builds with -Wall -Werror. + * libltdl/ltdl.c (try_dlopen): Use strlen rather than LT_STRLEN on + an array that will never be NULL. + 2009-11-01 Ralf Wildenhues <ralf.wildenh...@gmx.de> Fix func_normal_abspath sed script for Solaris. diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 80b5675..a622357 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -1264,7 +1264,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext, if (vtable) { /* name + "." + libext + NULL */ - archive_name = MALLOC (char, LT_STRLEN (name) + LT_STRLEN (libext) + 2); + archive_name = MALLOC (char, LT_STRLEN (name) + strlen (libext) + 2); *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle)); if ((*phandle == NULL) || (archive_name == NULL)) -- 1.6.4.2