]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libsystemd: link with '-z nodelete'
authorMichal Sekletar <msekleta@redhat.com>
Wed, 22 May 2024 15:15:07 +0000 (17:15 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 22 May 2024 20:09:25 +0000 (22:09 +0200)
We want to avoid reinitialization of our global variables with static
storage duration in case we get dlopened multiple times by the same
application. This will avoid potential resource leaks that could have
happened otherwise (e.g. leaking journal socket fd).

meson.build

index 0d68f146fd4f308ea5d59767746b5a1673c72b07..dfea903b60e08009965c9c25c579f99db7fe46c0 100644 (file)
@@ -2069,6 +2069,8 @@ libsystemd = shared_library(
         version : libsystemd_version,
         include_directories : libsystemd_includes,
         link_args : ['-shared',
+                     # Make sure our library is never deleted from memory, so that our open logging fds don't leak on dlopen/dlclose cycles.
+                     '-z', 'nodelete',
                      '-Wl,--version-script=' + libsystemd_sym_path],
         link_with : [libbasic],
         link_whole : [libsystemd_static],