* name-finder.cc (lookup): Ignore a null dli_fname from d

From-SVN: r45181
This commit is contained in:
Bryce McKinlay 2001-08-26 10:09:59 +00:00 committed by Bryce McKinlay
parent 51c4678a03
commit 387edc7625
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2001-08-26 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* name-finder.cc (lookup): Ignore a null dli_fname from dladdr.
2001-08-23 Tom Tromey <tromey@redhat.com>
* java/lang/reflect/Field.java (toString): Use

View file

@ -145,11 +145,13 @@ _Jv_name_finder::lookup (void *p)
if (dladdr (p, &dl_info))
{
strncpy (file_name, dl_info.dli_fname, sizeof file_name);
if (dl_info.dli_fname)
strncpy (file_name, dl_info.dli_fname, sizeof file_name);
strncpy (method_name, dl_info.dli_sname, sizeof method_name);
/* Don't trust dladdr() if the address is from the main program. */
if (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0)
if (dl_info.dli_fname != NULL
&& (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0))
return true;
}
}