summaryrefslogtreecommitdiffstats
path: root/stap-serverd
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2008-08-08 15:15:19 -0400
committerDave Brolley <brolley@redhat.com>2008-08-08 15:15:19 -0400
commit71906647386a9684086b0542318b536d95ae089c (patch)
treefb0348d7bb34095e95ad830da8e832bad9187a55 /stap-serverd
parentd5658775da9fa0ac792eb3f874df9f7c4d60de7e (diff)
parentf1118e1032612170cae8cd979cd529722ad95fdb (diff)
downloadsystemtap-steved-71906647386a9684086b0542318b536d95ae089c.tar.gz
systemtap-steved-71906647386a9684086b0542318b536d95ae089c.tar.xz
systemtap-steved-71906647386a9684086b0542318b536d95ae089c.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Conflicts: ChangeLog testsuite/ChangeLog
Diffstat (limited to 'stap-serverd')
-rwxr-xr-xstap-serverd10
1 files changed, 9 insertions, 1 deletions
diff --git a/stap-serverd b/stap-serverd
index e378f6e4..221f353f 100755
--- a/stap-serverd
+++ b/stap-serverd
@@ -26,6 +26,11 @@ function initialization {
avahi_type=_stap._tcp
port=$1
test "X$port" = "X" && port=65000
+ port2=$(($port + 1))
+ if netstat -atn | awk '{print $4}' | cut -f2 -d: | egrep -q "^($port|$port2)\$"; then
+ # Whoops, the port is busy; try another one.
+ initialization $((1024+($port + $RANDOM)%64000))
+ fi
}
# function: advertise_presence
@@ -35,7 +40,7 @@ function advertise_presence {
# Build up a string representing our server's properties.
# TODO: this needs fleshing out.
local sysinfo=`uname -rvm`
- local txt="$sysinfo"
+ local txt="sysinfo=$sysinfo"
# Call avahi-publish-service to advertise our presence.
avahi-publish-service "Systemtap Compile Server on `uname -n`" \
@@ -71,6 +76,9 @@ function listen {
first=0
fi
wait %nc
+ if [ $? -ne 0 ]; then
+ fatal "ERROR: cannot listen on port $port"
+ fi
done
}