[shell changes from patch from perl5.003_12 to perl5.003_13]
[p5sagit/p5-mst-13.2.git] / t / lib / io_sock.t
old mode 100644 (file)
new mode 100755 (executable)
index e888c5e..156f6cb
@@ -17,7 +17,10 @@ print "1..5\n";
 
 use IO::Socket;
 
-$port = 4002 + int(rand(time) & 0xff);
+srand(time);
+$port = 4002 + int(rand 0xff);
+print "# using port $port.\n";
+$SIG{ALRM} = sub {};
 
 $pid =  fork();
 
@@ -51,7 +54,6 @@ if($pid) {
     # Wait for a small pause, so that we can ensure the listen socket is setup
     # the parent will awake us with a SIGALRM
 
-    $SIG{ALRM} = sub {};
     sleep(10);
 
     $sock = IO::Socket::INET->new(PeerPort => $port,