Bug 569060 - dlclose does not return error if library already closed
Summary: dlclose does not return error if library already closed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 12
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Andreas Schwab
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-02-27 21:08 UTC by Quentin Armitage
Modified: 2010-03-01 10:24 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-03-01 10:24:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
dl.c sample code to demonstrate issue (537 bytes, text/plain)
2010-02-27 21:08 UTC, Quentin Armitage
no flags Details

Description Quentin Armitage 2010-02-27 21:08:43 UTC
Created attachment 396785 [details]
dl.c sample code to demonstrate issue

Description of problem:
Calling dlclose twice with the same handle returns 0 (SUCCESS) despite the library having already been closed. If fact, dlclose will return 0 for all subsequent calls for the same handle.

Version-Release number of selected component (if applicable):
glibc-2.11.1-1

How reproducible:
Always

Steps to Reproduce:
1.Compile attached dl.c
2.Execute dl
3.
  
Actual results:
dlopen returned 153825312
dlclose call 1 returned 0
dlclose call 2 returned 0

Expected results:
dlopen returned 146464800
dlclose call 1 returned 0
dlclose call 2 returned -1
dlclose call 2: ��: shared object not open


Additional info:
The problem occurs on F-12 with glibc-2.11.1-1. The expected results are produced on F-11 using glibc-2.10.2-1.

The above problem stops asterisk initialising, since in main/loader.c, it uses the following code:
while (!dlclose(lib));
On F-11, using glibc-2.10.2-1, the loop terminates once all instances of the library have been closed. On F-12 with glibc-2.11.1-1 the loop never terminates.

Comment 1 Andreas Schwab 2010-03-01 10:24:14 UTC
This is undefined behaviour.


Note You need to log in before you can comment on or make changes to this bug.