[Spice-devel] [PATCH spice-server v3] Return invalid value from very old obsolete functions

Frediano Ziglio fziglio at redhat.com
Wed Nov 30 12:58:44 UTC 2016


These functions are not used since years and are not supporting
multiple clients.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/main-channel.c | 12 ------------
 server/main-channel.h |  2 --
 server/reds.c         | 12 ++++--------
 3 files changed, 4 insertions(+), 22 deletions(-)

Changes since v2:
- propagate error to remove some internal functions.

diff --git a/server/main-channel.c b/server/main-channel.c
index 37b2f25..24dd448 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -306,18 +306,6 @@ MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client,
     return mcc;
 }
 
-int main_channel_getsockname(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen)
-{
-    return main_chan ?
-        getsockname(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1;
-}
-
-int main_channel_getpeername(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen)
-{
-    return main_chan ?
-        getpeername(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1;
-}
-
 MainChannel* main_channel_new(RedsState *reds)
 {
     // TODO: set the migration flag of the channel
diff --git a/server/main-channel.h b/server/main-channel.h
index cb53fb4..b70649c 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -65,8 +65,6 @@ void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode, int
 void main_channel_push_agent_connected(MainChannel *main_chan);
 void main_channel_push_agent_disconnected(MainChannel *main_chan);
 void main_channel_push_multi_media_time(MainChannel *main_chan, int time);
-int main_channel_getsockname(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen);
-int main_channel_getpeername(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen);
 
 int main_channel_is_connected(MainChannel *main_chan);
 
diff --git a/server/reds.c b/server/reds.c
index bc0cc01..5b18162 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3848,20 +3848,16 @@ SPICE_GNUC_VISIBLE int spice_server_set_channel_security(SpiceServer *s, const c
     return -1;
 }
 
+/* very obsolete and old function, retain only for ABI */
 SPICE_GNUC_VISIBLE int spice_server_get_sock_info(SpiceServer *reds, struct sockaddr *sa, socklen_t *salen)
 {
-    if (main_channel_getsockname(reds->main_channel, sa, salen) < 0) {
-        return -1;
-    }
-    return 0;
+    return -1;
 }
 
+/* very obsolete and old function, retain only for ABI */
 SPICE_GNUC_VISIBLE int spice_server_get_peer_info(SpiceServer *reds, struct sockaddr *sa, socklen_t *salen)
 {
-    if (main_channel_getpeername(reds->main_channel, sa, salen) < 0) {
-        return -1;
-    }
-    return 0;
+    return -1;
 }
 
 SPICE_GNUC_VISIBLE int spice_server_is_server_mouse(SpiceServer *reds)
-- 
2.9.3



More information about the Spice-devel mailing list