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

Submitted by Frediano Ziglio on Nov. 30, 2016, 12:58 p.m.

Details

Message ID 20161130125844.18218-1-fziglio@redhat.com
State New
Headers show
Series "Start cleaning objects on destruction" ( rev: 4 3 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 30, 2016, 12:58 p.m.
These functions are not used since years and are not supporting
multiple clients.

Signed-off-by: Frediano Ziglio <fziglio@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.

Patch hide | download patch | download mbox

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)

Comments

On Wed, 2016-11-30 at 12:58 +0000, Frediano Ziglio wrote:
> These functions are not used since years and are not supporting
> multiple clients.
> 
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>

Thanks,
Pavel

> ---
>  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_c
> han)), 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_c
> han)), 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)