[Spice-devel,v2,07/19] Return invalid value from very old obsolete functions

Submitted by Frediano Ziglio on Nov. 25, 2016, 2:52 p.m.

Details

Message ID 81f13ce83716a111aeaba9a97449449047455543.1480085518.git-series.fziglio@redhat.com
State New
Headers show
Series "Start cleaning objects on destruction" ( rev: 2 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 25, 2016, 2:52 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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/main-channel.c b/server/main-channel.c
index 37b2f25..3d107c4 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -306,16 +306,16 @@  MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client,
     return mcc;
 }
 
+/* very obsolete and old function, retain only for ABI */
 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;
+    return -1;
 }
 
+/* very obsolete and old function, retain only for ABI */
 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;
+    return -1;
 }
 
 MainChannel* main_channel_new(RedsState *reds)

Comments

Hi,

Why not return -1 in spice_server_get_sock_info() and
spice_server_get_peer_info() and remove these main channel functions.

Also the public function should be marked as deprecated if their usage
 should be avoided

Pavel

On Fri, 2016-11-25 at 14:52 +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>
> ---
>  server/main-channel.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/server/main-channel.c b/server/main-channel.c
> index 37b2f25..3d107c4 100644
> --- a/server/main-channel.c
> +++ b/server/main-channel.c
> @@ -306,16 +306,16 @@ MainChannelClient
> *main_channel_link(MainChannel *channel, RedClient *client,
>      return mcc;
>  }
>  
> +/* very obsolete and old function, retain only for ABI */
>  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;
> +    return -1;
>  }
>  
> +/* very obsolete and old function, retain only for ABI */
>  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;
> +    return -1;
>  }
>  
>  MainChannel* main_channel_new(RedsState *reds)
> 
> Hi,
> 
> Why not return -1 in spice_server_get_sock_info() and
> spice_server_get_peer_info() and remove these main channel functions.
> 

Next commit remove this function.

> Also the public function should be marked as deprecated if their usage
>  should be avoided
> 

They already are.

> Pavel
> 

Frediano

> On Fri, 2016-11-25 at 14:52 +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>
> > ---
> >  server/main-channel.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/server/main-channel.c b/server/main-channel.c
> > index 37b2f25..3d107c4 100644
> > --- a/server/main-channel.c
> > +++ b/server/main-channel.c
> > @@ -306,16 +306,16 @@ MainChannelClient
> > *main_channel_link(MainChannel *channel, RedClient *client,
> >      return mcc;
> >  }
> >  
> > +/* very obsolete and old function, retain only for ABI */
> >  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;
> > +    return -1;
> >  }
> >  
> > +/* very obsolete and old function, retain only for ABI */
> >  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;
> > +    return -1;
> >  }
> >  
> >  MainChannel* main_channel_new(RedsState *reds)
>
On Wed, 2016-11-30 at 07:43 -0500, Frediano Ziglio wrote:
> > 
> > Hi,
> > 
> > Why not return -1 in spice_server_get_sock_info() and
> > spice_server_get_peer_info() and remove these main channel
> > functions.
> > 
> 
> Next commit remove this function.

It doesn't

spice_server_get_peer_info and spice_server_get_sock_info are using
main_channel_get{peer, sock}name function

> 
> > Also the public function should be marked as deprecated if their
> > usage
> >  should be avoided
> > 
> 
> They already are.
> 
> > Pavel
> > 
> 
> Frediano
> 
> > On Fri, 2016-11-25 at 14:52 +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>
> > > ---
> > >  server/main-channel.c | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/server/main-channel.c b/server/main-channel.c
> > > index 37b2f25..3d107c4 100644
> > > --- a/server/main-channel.c
> > > +++ b/server/main-channel.c
> > > @@ -306,16 +306,16 @@ MainChannelClient
> > > *main_channel_link(MainChannel *channel, RedClient *client,
> > >      return mcc;
> > >  }
> > >  
> > > +/* very obsolete and old function, retain only for ABI */
> > >  int main_channel_getsockname(MainChannel *main_chan, struct
> > > sockaddr *sa, socklen_t *salen)
> > >  {
> > > -    return main_chan ?
> > > -        getsockname(red_channel_get_first_socket(RED_CHANNEL(ma
> > > in_c
> > > han)), sa, salen) : -1;
> > > +    return -1;
> > >  }
> > >  
> > > +/* very obsolete and old function, retain only for ABI */
> > >  int main_channel_getpeername(MainChannel *main_chan, struct
> > > sockaddr *sa, socklen_t *salen)
> > >  {
> > > -    return main_chan ?
> > > -        getpeername(red_channel_get_first_socket(RED_CHANNEL(ma
> > > in_c
> > > han)), sa, salen) : -1;
> > > +    return -1;
> > >  }
> > >  
> > >  MainChannel* main_channel_new(RedsState *reds)
> 
> On Wed, 2016-11-30 at 07:43 -0500, Frediano Ziglio wrote:
> > > 
> > > Hi,
> > > 
> > > Why not return -1 in spice_server_get_sock_info() and
> > > spice_server_get_peer_info() and remove these main channel
> > > functions.
> > > 
> > 
> > Next commit remove this function.
> 
> It doesn't
> 
> spice_server_get_peer_info and spice_server_get_sock_info are using
> main_channel_get{peer, sock}name function
> 

Sorry, I completely misread your reply

Yes, I'll post an update.

Frediano

> > 
> > > Also the public function should be marked as deprecated if their
> > > usage
> > >  should be avoided
> > > 
> > 
> > They already are.
> > 
> > > Pavel
> > > 
> > 
> > Frediano
> > 
> > > On Fri, 2016-11-25 at 14:52 +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>
> > > > ---
> > > >  server/main-channel.c | 8 ++++----
> > > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/server/main-channel.c b/server/main-channel.c
> > > > index 37b2f25..3d107c4 100644
> > > > --- a/server/main-channel.c
> > > > +++ b/server/main-channel.c
> > > > @@ -306,16 +306,16 @@ MainChannelClient
> > > > *main_channel_link(MainChannel *channel, RedClient *client,
> > > >      return mcc;
> > > >  }
> > > >  
> > > > +/* very obsolete and old function, retain only for ABI */
> > > >  int main_channel_getsockname(MainChannel *main_chan, struct
> > > > sockaddr *sa, socklen_t *salen)
> > > >  {
> > > > -    return main_chan ?
> > > > -        getsockname(red_channel_get_first_socket(RED_CHANNEL(ma
> > > > in_c
> > > > han)), sa, salen) : -1;
> > > > +    return -1;
> > > >  }
> > > >  
> > > > +/* very obsolete and old function, retain only for ABI */
> > > >  int main_channel_getpeername(MainChannel *main_chan, struct
> > > > sockaddr *sa, socklen_t *salen)
> > > >  {
> > > > -    return main_chan ?
> > > > -        getpeername(red_channel_get_first_socket(RED_CHANNEL(ma
> > > > in_c
> > > > han)), sa, salen) : -1;
> > > > +    return -1;
> > > >  }
> > > >  
> > > >  MainChannel* main_channel_new(RedsState *reds)
>