From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 2/3] main: Fix failure cleanup sequence
Date: Wed, 08 Apr 2020 18:44:16 -0700 [thread overview]
Message-ID: <20200409014417.10029-2-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20200409014417.10029-1-tim.a.kourt@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]
---
src/main.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/main.c b/src/main.c
index acd72131..b5ccc63b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -476,12 +476,12 @@ int main(int argc, char *argv[])
exit_status = EXIT_FAILURE;
if (!storage_create_dirs())
- goto fail_dbus;
+ goto failed_dirs;
genl = l_genl_new();
if (!genl) {
l_error("Failed to open generic netlink socket");
- goto fail_genl;
+ goto failed_genl;
}
if (getenv("IWD_GENL_DEBUG"))
@@ -490,7 +490,7 @@ int main(int argc, char *argv[])
rtnl = l_netlink_new(NETLINK_ROUTE);
if (!rtnl) {
l_error("Failed to open route netlink socket");
- goto fail_rtnl;
+ goto failed_rtnl;
}
if (getenv("IWD_RTNL_DEBUG"))
@@ -499,7 +499,7 @@ int main(int argc, char *argv[])
dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
if (!dbus) {
l_error("Failed to initialize D-Bus");
- goto fail_dbus;
+ goto failed_dbus;
}
if (enable_dbus_debug)
@@ -510,18 +510,24 @@ int main(int argc, char *argv[])
dbus_init(dbus);
exit_status = l_main_run_with_signal(signal_handler, NULL);
+
plugin_exit();
iwd_modules_exit();
dbus_exit();
l_dbus_destroy(dbus);
- storage_cleanup_dirs();
-fail_dbus:
- l_genl_unref(genl);
-fail_rtnl:
+failed_dbus:
+
l_netlink_destroy(rtnl);
-fail_genl:
+failed_rtnl:
+
+ l_genl_unref(genl);
+failed_genl:
+
+ storage_cleanup_dirs();
+failed_dirs:
+
l_settings_free(iwd_config);
l_timeout_remove(timeout);
--
2.13.6
next prev parent reply other threads:[~2020-04-09 1:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 1:44 [PATCH 1/3] storage: Refactor dirs creation logic to cleanup on failure Tim Kourt
2020-04-09 1:44 ` Tim Kourt [this message]
2020-04-09 1:44 ` [PATCH 3/3] main: Simplify config file search logic Tim Kourt
2020-04-09 15:41 ` [PATCH 1/3] storage: Refactor dirs creation logic to cleanup on failure Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200409014417.10029-2-tim.a.kourt@linux.intel.com \
--to=tim.a.kourt@linux.intel.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox