summaryrefslogtreecommitdiff
path: root/src/shared/idn-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/idn-util.c')
-rw-r--r--src/shared/idn-util.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/shared/idn-util.c b/src/shared/idn-util.c
index 63a9ebf99d..6dda3af54c 100644
--- a/src/shared/idn-util.c
+++ b/src/shared/idn-util.c
@@ -21,32 +21,11 @@ const char *(*sym_idn2_strerror)(int rc) = NULL;
int (*sym_idn2_to_unicode_8z8z)(const char * input, char ** output, int flags) = NULL;
int dlopen_idn(void) {
- _cleanup_(dlclosep) void *dl = NULL;
- int r;
-
- if (idn_dl)
- return 0; /* Already loaded */
-
- dl = dlopen("libidn2.so.0", RTLD_LAZY);
- if (!dl)
- return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
- "libidn2 support is not installed: %s", dlerror());
-
- r = dlsym_many_or_warn(
- dl,
- LOG_DEBUG,
+ return dlopen_many_sym_or_warn(
+ &idn_dl, "libidn2.so.0", LOG_DEBUG,
DLSYM_ARG(idn2_lookup_u8),
DLSYM_ARG(idn2_strerror),
- DLSYM_ARG(idn2_to_unicode_8z8z),
- NULL);
- if (r < 0)
- return r;
-
- /* Note that we never release the reference here, because there's no real reason to, after all this
- * was traditionally a regular shared library dependency which lives forever too. */
- idn_dl = TAKE_PTR(dl);
-
- return 1;
+ DLSYM_ARG(idn2_to_unicode_8z8z));
}
#endif