On Fri, 2011-12-09 at 21:53 +0100, Reinhard Tartler wrote:
> On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
> 
> 
> > --- a/x2goserver/bin/x2gostartagent
> > +++ b/x2goserver/bin/x2gostartagent
> > @@ -120,8 +120,8 @@ USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME`
> >  while [ "$OUTPUT"  != "inserted" ]; do
> >     X2GO_PORT=$(($X2GO_PORT + 1))
> >     X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){ 
> > if(\"$USED_DISPLAYS\" =~ 
> > m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
> > -
> > -   if  [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e 
> > "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
> > +   #Test if the session is already in use. nxagent uses 6000+DISPLAY to 
> > open a port. Therefore this must be tested, too.
> > +   if  [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e 
> > "/tmp/.X11-unix/X${X2GO_PORT}" ] || `netstat -ntl | grep ":${X2GO_PORT} "` 
> > ; then
> >             OUTPUT="XXX"
> >     else
> >             SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
> 
> That looks overly convoluted to me. What about this (untested, but shell
> syntax works):
> 
> if  [ -e "/tmp/.X${X2GO_PORT}-lock" ] || 
>     [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] ||
>     netstat -ntl 2>/dev/null | grep -q ":${X2GO_PORT}"; then
>       OUTPUT="XXX"
> else
>       SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
> fi
> 
> Cheers,
> Reinhard
> 
What if X2GO_PORT is 6051 and for some reason there is a service
listening on port 60513? Won't it erroneously match? - John

_______________________________________________
X2go-Dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/x2go-dev

Reply via email to