From a596a3655ad86e7300c0317a6cccdfbcb7e7964dd6ecc5a3ffdfe3f03c163cf2 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 21 Oct 2014 11:30:20 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=804 --- avoid-leaking-socket-descriptors.patch | 285 ++++++++++++++++++++++++- 1 file changed, 277 insertions(+), 8 deletions(-) diff --git a/avoid-leaking-socket-descriptors.patch b/avoid-leaking-socket-descriptors.patch index ec23fd5c..1ab7c9ed 100644 --- a/avoid-leaking-socket-descriptors.patch +++ b/avoid-leaking-socket-descriptors.patch @@ -1,11 +1,81 @@ ---- - src/core/dbus.c | 2 +- - src/libsystemd/sd-bus/bus-util.h | 9 +++++++++ - src/login/pam-module.c | 4 ++-- - 3 files changed, 12 insertions(+), 3 deletions(-) +Based on 249968612f16a71df909d6e73785c18a9ff36a65 +with src/core/dbus.c as well +--- + src/analyze/analyze.c | 2 +- + src/bus-proxyd/bus-proxyd.c | 4 +--- + src/cgroups-agent/cgroups-agent.c | 4 +--- + src/core/dbus.c | 2 +- + src/fsck/fsck.c | 2 +- + src/hostname/hostnamectl.c | 2 +- + src/hostname/hostnamed.c | 4 ++-- + src/libsystemd/sd-bus/bus-util.h | 9 +++++++++ + src/libsystemd/sd-bus/busctl.c | 2 +- + src/locale/localectl.c | 2 +- + src/locale/localed.c | 4 ++-- + src/login/inhibit.c | 2 +- + src/login/loginctl.c | 2 +- + src/login/pam-module.c | 4 ++-- + src/machine/machinectl.c | 4 ++-- + src/nspawn/nspawn.c | 4 ++-- + src/run/run.c | 2 +- + src/systemctl/systemctl.c | 2 +- + src/timedate/timedatectl.c | 2 +- + src/timedate/timedated.c | 4 ++-- + 20 files changed, 34 insertions(+), 29 deletions(-) + +--- src/analyze/analyze.c ++++ src/analyze/analyze.c 2014-10-21 11:13:56.113045992 +0000 +@@ -1264,7 +1264,7 @@ static int parse_argv(int argc, char *ar + } + + int main(int argc, char *argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); +--- src/bus-proxyd/bus-proxyd.c ++++ src/bus-proxyd/bus-proxyd.c 2014-10-21 11:16:16.303837968 +0000 +@@ -427,7 +427,7 @@ static int patch_sender(sd_bus *a, sd_bu + + int main(int argc, char *argv[]) { + +- _cleanup_bus_unref_ sd_bus *a = NULL, *b = NULL; ++ _cleanup_bus_close_unref_ sd_bus *a = NULL, *b = NULL; + sd_id128_t server_id; + int r, in_fd, out_fd; + bool got_hello = false; +@@ -777,8 +777,6 @@ int main(int argc, char *argv[]) { + r = 0; + + finish: +- sd_bus_flush(a); +- sd_bus_flush(b); + + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + } +--- src/cgroups-agent/cgroups-agent.c ++++ src/cgroups-agent/cgroups-agent.c 2014-10-21 11:17:37.400197469 +0000 +@@ -26,7 +26,7 @@ + #include "bus-util.h" + + int main(int argc, char *argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + if (argc != 2) { +@@ -62,7 +62,5 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + +- sd_bus_flush(bus); +- + return EXIT_SUCCESS; + } --- src/core/dbus.c -+++ src/core/dbus.c 2014-10-17 09:52:47.227838182 +0000 ++++ src/core/dbus.c 2014-10-17 09:52:47.000000000 +0000 @@ -639,7 +639,7 @@ static int bus_setup_disconnected_match( } @@ -15,8 +85,50 @@ _cleanup_close_ int nfd = -1; Manager *m = userdata; sd_id128_t id; +--- src/fsck/fsck.c ++++ src/fsck/fsck.c 2014-10-21 11:18:06.003838037 +0000 +@@ -45,7 +45,7 @@ static bool arg_show_progress = false; + + static void start_target(const char *target) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + assert(target); +--- src/hostname/hostnamectl.c ++++ src/hostname/hostnamectl.c 2014-10-21 11:18:19.915858156 +0000 +@@ -468,7 +468,7 @@ static int hostnamectl_main(sd_bus *bus, + } + + int main(int argc, char *argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); +--- src/hostname/hostnamed.c ++++ src/hostname/hostnamed.c 2014-10-21 11:24:07.737447673 +0000 +@@ -566,7 +566,7 @@ static const sd_bus_vtable hostname_vtab + }; + + static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + assert(c); +@@ -607,7 +607,7 @@ int main(int argc, char *argv[]) { + Context context = {}; + + _cleanup_event_unref_ sd_event *event = NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + log_set_target(LOG_TARGET_AUTO); --- src/libsystemd/sd-bus/bus-util.h -+++ src/libsystemd/sd-bus/bus-util.h 2014-10-17 09:51:34.368337493 +0000 ++++ src/libsystemd/sd-bus/bus-util.h 2014-10-17 09:51:34.000000000 +0000 @@ -137,11 +137,20 @@ typedef struct UnitInfo { int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); @@ -38,8 +150,72 @@ #define _cleanup_bus_message_unref_ _cleanup_(sd_bus_message_unrefp) #define _cleanup_bus_creds_unref_ _cleanup_(sd_bus_creds_unrefp) #define _cleanup_bus_error_free_ _cleanup_(sd_bus_error_free) +--- src/libsystemd/sd-bus/busctl.c ++++ src/libsystemd/sd-bus/busctl.c 2014-10-21 11:19:01.472337887 +0000 +@@ -484,7 +484,7 @@ static int busctl_main(sd_bus *bus, int + } + + int main(int argc, char *argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + log_parse_environment(); +--- src/locale/localectl.c ++++ src/locale/localectl.c 2014-10-21 11:19:13.811947994 +0000 +@@ -796,7 +796,7 @@ static int localectl_main(sd_bus *bus, i + } + + int main(int argc, char*argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); +--- src/locale/localed.c ++++ src/locale/localed.c 2014-10-21 11:19:28.415837424 +0000 +@@ -1076,7 +1076,7 @@ static const sd_bus_vtable locale_vtable + }; + + static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + assert(c); +@@ -1116,7 +1116,7 @@ static int connect_bus(Context *c, sd_ev + int main(int argc, char *argv[]) { + Context context = {}; + _cleanup_event_unref_ sd_event *event = NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + log_set_target(LOG_TARGET_AUTO); +--- src/login/inhibit.c ++++ src/login/inhibit.c 2014-10-21 11:19:44.470844885 +0000 +@@ -221,7 +221,7 @@ static int parse_argv(int argc, char *ar + + int main(int argc, char *argv[]) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + log_parse_environment(); +--- src/login/loginctl.c ++++ src/login/loginctl.c 2014-10-21 11:20:16.695837857 +0000 +@@ -1298,7 +1298,7 @@ static int loginctl_main(sd_bus *bus, in + } + + int main(int argc, char *argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); --- src/login/pam-module.c -+++ src/login/pam-module.c 2014-10-21 10:48:20.129001984 +0000 ++++ src/login/pam-module.c 2014-10-21 10:48:20.000000000 +0000 @@ -213,7 +213,7 @@ _public_ PAM_EXTERN int pam_sm_open_sess *seat = NULL, *type = NULL, *class = NULL, @@ -58,3 +234,96 @@ const void *existing = NULL; const char *id; int r; +--- src/machine/machinectl.c ++++ src/machine/machinectl.c 2014-10-21 11:20:45.747838104 +0000 +@@ -550,7 +550,7 @@ static int openpt_in_namespace(pid_t pid + static int login_machine(sd_bus *bus, char **args, unsigned n) { + _cleanup_bus_message_unref_ sd_bus_message *reply = NULL, *reply2 = NULL, *reply3 = NULL; + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; +- _cleanup_bus_unref_ sd_bus *container_bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *container_bus = NULL; + _cleanup_close_ int master = -1; + _cleanup_free_ char *getty = NULL; + const char *path, *pty, *p; +@@ -879,7 +879,7 @@ static int machinectl_main(sd_bus *bus, + } + + int main(int argc, char*argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); +--- src/nspawn/nspawn.c ++++ src/nspawn/nspawn.c 2014-10-21 11:21:05.561523449 +0000 +@@ -1163,7 +1163,7 @@ static int drop_capabilities(void) { + + static int register_machine(pid_t pid) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + if (!arg_register) +@@ -1285,7 +1285,7 @@ static int register_machine(pid_t pid) { + static int terminate_machine(pid_t pid) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + const char *path; + int r; + +--- src/run/run.c ++++ src/run/run.c 2014-10-21 11:22:35.163838021 +0000 +@@ -462,7 +462,7 @@ static int start_transient_scope( + + int main(int argc, char* argv[]) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + _cleanup_free_ char *description = NULL, *command = NULL; + int r; + +--- src/systemctl/systemctl.c ++++ src/systemctl/systemctl.c 2014-10-21 11:22:48.516338154 +0000 +@@ -6436,7 +6436,7 @@ static int runlevel_main(void) { + } + + int main(int argc, char*argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); +--- src/timedate/timedatectl.c ++++ src/timedate/timedatectl.c 2014-10-21 11:23:06.107837988 +0000 +@@ -593,7 +593,7 @@ static int timedatectl_main(sd_bus *bus, + } + + int main(int argc, char *argv[]) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + setlocale(LC_ALL, ""); +--- src/timedate/timedated.c ++++ src/timedate/timedated.c 2014-10-21 11:23:26.047838675 +0000 +@@ -779,7 +779,7 @@ static const sd_bus_vtable timedate_vtab + }; + + static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + assert(c); +@@ -825,7 +825,7 @@ int main(int argc, char *argv[]) { + }; + + _cleanup_event_unref_ sd_event *event = NULL; +- _cleanup_bus_unref_ sd_bus *bus = NULL; ++ _cleanup_bus_close_unref_ sd_bus *bus = NULL; + int r; + + log_set_target(LOG_TARGET_AUTO);