vmware-iso: Fix error vnc min/max ports [GH-1288]

This commit is contained in:
Jason A. Beranek 2014-08-18 20:15:15 -05:00
parent 1e5d746783
commit 6acbc91ff7
1 changed files with 6 additions and 1 deletions

View File

@ -34,7 +34,12 @@ func (stepConfigureVNC) VNCAddress(portMin, portMax uint) (string, uint) {
var vncPort uint
portRange := int(portMax - portMin)
for {
vncPort = uint(rand.Intn(portRange)) + portMin
if portRange > 0 {
vncPort = uint(rand.Intn(portRange)) + portMin
} else {
vncPort = portMin
}
log.Printf("Trying port: %d", vncPort)
l, err := net.Listen("tcp", fmt.Sprintf(":%d", vncPort))
if err == nil {