[PATCH 04/13] ipaccess: improve error handling

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Pablo Neira Ayuso pablo at gnumonks.org
Fri Aug 24 10:09:08 UTC 2012


On Fri, Aug 24, 2012 at 08:45:26AM +0200, Holger Hans Peter Freyther wrote:
> On Fri, Aug 24, 2012 at 12:44:53AM +0200, pablo at gnumonks.org wrote:
> > From: Pablo Neira Ayuso <pablo at gnumonks.org>
> 
> > @@ -592,15 +634,25 @@ static int ipaccess_bsc_oml_cb(struct ipa_server_link *link, int fd)
> >  	ret = osmo_fd_register(bfd);
> >  	if (ret < 0) {
> >  		LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
> > -		close(bfd->fd);
> > -		e1inp_line_put(line);
> > -		return ret;
> > +		goto err_line;
> 
> 
> 
> > -        return ret;
> > +err_socket:
> > +	osmo_fd_unregister(bfd);
> > +	close(bfd->fd);
> > +	bfd->fd = -1;
> > +err_line:
> > +	e1inp_line_put(line);
> > +	return ret;
> >  }
> 
> in this case the socket was closed and remains open now? It needs to jump under the
> osmo_fd_unregister line.
> 
> 
> >  	/* initialize the fds */
> >  	for (i = 0; i < ARRAY_SIZE(line->ts); ++i)
> > @@ -636,14 +688,24 @@ static int ipaccess_bsc_rsl_cb(struct ipa_server_link *link, int fd)
> >  	ret = osmo_fd_register(bfd);
> >  	if (ret < 0) {
> >  		LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
> > -		close(bfd->fd);
> > -		e1inp_line_put(line);
> > -		return ret;
> > +		goto err_line;
> 
> same as above.

Yes, this has to be:

err_socket:                                                                      
        osmo_fd_unregister(bfd);                                                 
err_line:                                                                        
        close(bfd->fd);                                                          
        bfd->fd = -1;                                                            
        e1inp_line_put(line);                                                    
        return ret;

Thanks Holger. New patch attached.


More information about the OpenBSC mailing list