Description of problem: dlclose(NULL) segfaults - Single Unix v3 implies this should not: "If the object could not be closed, or if handle does not refer to an open object, dlclose() shall return a non-zero value" Version-Release number of selected component (if applicable): glibc-2.3.1-46 How reproducible: Always Steps to Reproduce: 1. cat > dl.c <<EOF #include <dlfcn.h> int main() { dlclose(0L); } EOF 2. cc dl.c -dl 3. ./a.out Actual results: Segfault Expected results: nothing Additional info:
It should and it always will. There is no way to reliably test for invalid descriptors and in any case it would be a burden which correct programs has to carry. glibc is a runtime library, no debugging library. And POSIX/SUS never requires that such tests are performed. In some cases wording like this might have slipped into the specification but it would be changed immediately when reported.