[libdmapsharing] dmap-share: Use idiomatic way of checking for errors
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] dmap-share: Use idiomatic way of checking for errors
- Date: Mon, 26 Jun 2017 15:59:09 +0000 (UTC)
commit f92c96974083faafd9475130b37cbb85bb61f376
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jun 26 15:00:00 2017 +0200
dmap-share: Use idiomatic way of checking for errors
Use the retval of the API, instead of assuming that the API will always
set the error (it'd be a bug, but at least we'd go down the correct
branch).
https://bugzilla.gnome.org/show_bug.cgi?id=766723
Signed-off-by: W. Michael Petullo <mike flyn org>
libdmapsharing/dmap-share.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/libdmapsharing/dmap-share.c b/libdmapsharing/dmap-share.c
index e92449f..a302e73 100644
--- a/libdmapsharing/dmap-share.c
+++ b/libdmapsharing/dmap-share.c
@@ -233,6 +233,7 @@ _dmap_share_server_start (DMAPShare *share)
GError *error = NULL;
GSList *listening_uri_list;
SoupURI *listening_uri;
+ gboolean ret;
share->priv->server = soup_server_new (NULL, NULL);
@@ -284,19 +285,19 @@ _dmap_share_server_start (DMAPShare *share)
(SoupServerCallback) ctrl_int_adapter,
share, NULL);
- soup_server_listen_all (share->priv->server, desired_port, 0, &error);
+ ret = soup_server_listen_all (share->priv->server, desired_port, 0, &error);
- if (error != NULL) {
+ if (ret == FALSE) {
g_warning ("Unable to start music sharing server on port %d: %s. "
"Trying any open IPv6 port", desired_port, error->message);
g_clear_error (&error);
- soup_server_listen_all (share->priv->server, SOUP_ADDRESS_ANY_PORT,
- 0, &error);
+ ret = soup_server_listen_all (share->priv->server, SOUP_ADDRESS_ANY_PORT,
+ 0, &error);
}
listening_uri_list = soup_server_get_uris (share->priv->server);
- if (listening_uri_list == NULL) {
+ if (ret == FALSE || listening_uri_list == NULL) {
g_warning ("Unable to start music sharing server on any port.");
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]