]> git.ipfire.org Git - thirdparty/glibc.git/blame - dlfcn/dlclose.c
Fix implicit-fallthrough warnings in tst-setjmp.c.
[thirdparty/glibc.git] / dlfcn / dlclose.c
CommitLineData
26b4d766 1/* Close a handle opened by `dlopen'.
04277e02 2 Copyright (C) 1995-2019 Free Software Foundation, Inc.
afd4eb37 3 This file is part of the GNU C Library.
d66e34cd 4
afd4eb37 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
d66e34cd 9
afd4eb37
UD
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
d66e34cd 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
d66e34cd 18
d66e34cd 19#include <dlfcn.h>
9dcafc55 20#include <ldsodefs.h>
d66e34cd 21
9b42a0b3 22#if !defined SHARED && IS_IN (libdl)
5f21997b
UD
23
24int
25dlclose (void *handle)
26{
27 return __dlclose (handle);
28}
29
30#else
31
993b3242
UD
32static void
33dlclose_doit (void *handle)
34{
9dcafc55 35 GLRO(dl_close) (handle);
993b3242
UD
36}
37
d66e34cd 38int
5f21997b 39__dlclose (void *handle)
d66e34cd 40{
5f21997b 41# ifdef SHARED
8e1472d2 42 if (!rtld_active ())
5f21997b
UD
43 return _dlfcn_hook->dlclose (handle);
44# endif
45
993b3242 46 return _dlerror_run (dlclose_doit, handle) ? -1 : 0;
d66e34cd 47}
5f21997b
UD
48# ifdef SHARED
49strong_alias (__dlclose, dlclose)
50# endif
51#endif