Am Freitag, den 11.04.2014, 10:33 -0300 schrieb Richard:
> Em 11-04-2014 06:48, Fuchs, Andreas escreveu:
> > Disclaimer:
> > I could not complie-test or runtime-test these patches right now. This is a
> > pure code-only review of the patches.
> >
> > Actually, I think the error was a different one. Right now, it seems as if
> > the server socket is never closed, unless that happens in a different file
> > ?!?
> > Should sd and sd6 both be global variables and both be "if (sd{4,6} != -1)
> > close(sd{4,6});" in tcsd_signal_term ?
> That's the idea. That function only setups a server socket and puts it
> in listen state. Another part of the code is reponsible for the connect
> and yet another part is reponsible for closing.
>
> No! No need to use global vars here, since each thread spawned by
> trousers can be responsible for its own socket handle.
I see this for the connection-sockets, that are all associated with
their own thread, but what about the server-listen-sockets ?
At least I don't see any place that would close them.
Possibly, the sigterm-handler was the wrong place to put it to begin
with. I guess tcsd_shutdown() should take the socks_info struct from
main() as parameter and close all those listen-sockets.
> > Am Mittwoch, den 09.04.2014, 15:41 -0300 schrieb [email protected]:
> >> From: Richard Maciel <[email protected]>
> >>
> >> Related to coverity CID 10302
> >>
> >> A global variable sd (which shouldn't exist, thus was removed) was
> >> used as a consequence of a programming typo. The right variable to
> >> be used is sd6.
> >>
> >> Signed-off-by: Richard Maciel <[email protected]>
> >> ---
> >> src/tcsd/svrside.c | 4 +---
> >> 1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/src/tcsd/svrside.c b/src/tcsd/svrside.c
> >> index 807d1ea..bf4d629 100644
> >> --- a/src/tcsd/svrside.c
> >> +++ b/src/tcsd/svrside.c
> >> @@ -44,7 +44,6 @@ struct tcsd_config tcsd_options;
> >> struct tpm_properties tpm_metrics;
> >> static volatile int hup = 0, term = 0;
> >> extern char *optarg;
> >> -int sd;
> >> char *tcsd_config_file = NULL;
> >>
> >> struct srv_sock_info {
> >> @@ -72,7 +71,6 @@ static void
> >> tcsd_signal_term(int signal)
> >> {
> >> term = 1;
> >> - close(sd);
> >> }
> >>
> >> void
> >> @@ -324,7 +322,7 @@ int setup_ipv6_socket(struct srv_sock_info *ssi)
> >> return 0;
> >>
> >> err:
> >> - if (sd != -1)
> >> + if (sd6 != -1)
> >> close(sd6);
> >>
> >> return -1;
>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech