bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ltdl misuse? (Gary... :-)


From: akim
Subject: ltdl misuse? (Gary... :-)
Date: Sun, 12 Aug 2001 12:52:14 +0200
User-agent: Mutt/1.3.18i

Hi!

I believe -M is dead broken.  I don't know ltdl too well (i.e., not at
all), but according to the weird behavior of multi -M, and according
to fprintf, I think this code is broken:

      case 'M':
        {
          const char *search_path = lt_dlgetsearchpath ();
          if (lt_dlsetsearchpath (optarg) != 0)
          {
            const char *dlerr = lt_dlerror();
            if (dlerr == NULL)
              M4ERROR ((EXIT_FAILURE, 0,
                        _("ERROR: failed to add search directory `%s'"),
                        optarg));
            else
              M4ERROR ((EXIT_FAILURE, 0,
                        _("ERROR: failed to add search directory `%s': %s"),
                        optarg, dlerr));
          }
          if (search_path)
            lt_dladdsearchdir (search_path);
        }
        break;

My guess is that lt_dlgetsearchpath returns a privately allocated
string which has no reason to be kept alive accross lt_dlsetsearchpath
calls.  Therefore, the last lt_dladdsearchdir part has no reason to
do what was expected.  In particular, unless there is reallocation,
in most cases it just means setting the path to twice optarg.

I suppose the goal is to preprend optarg instead of appending it.  But
then, either we need to strdup somewhere, or ltdl should provide means
to do that cleanly.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]