zonename should dlopen libzonecfg, or link with it, but not both
Unless there's some deep reason I'm missing, zonename links to libzonecfg lazily and dlopens it, both in an attempt to work before /usr is present (which it can't not be, these days). It should do one or the other, probably it should just link it and stop dlopening
Updated by Joshua M. Clulow about 1 month ago
It looks like what is going on is that the lazy-loaded symbol usage is gated on whether the
dlopen() call succeeds or not. Lazy loading for the calls to those functions occurs at the call site (via the PLT) and thus won't happen if the
dlopen() call fails.
If we assume the "maybe
libzonecfg.so isn't here" use case is sound, this is not quite as poorly conceived as it might first appear. The comment above the call could absolutely make this clearer. One could imagine this might still be useful in certain reduced ramdisk or installer contexts.