Jump to content
The Uniform Server Community

As if a space smart ;-)


Shyokou Ouyou
 Share

Recommended Posts

I was a little bit fashion to try both Carbo 6.0.1 and Carbo 6.0.2, but found both omitted a space smart ;-)

I mean, the omitted space in the definition of function 'port_in_use()' in file 'UniServer/unicon/main/includes/functions.php' ... At least in the Nano 5.6.X series, the space counts; but in the new Carbo 6.0.X, it may lead to ridiculous and erroneous 'port in use' message for just something listens on 0.0.0.0:80X or 0.0.0.0:80XX ...

In order to fix that without interfering with other parts, I applied this patch:

--- Carbo_6_0_2/UniServer/unicon/main/includes/functions.php	2010-08-13 01:25:56.453125000 +0800
+++ Carbo_6_0_2/UniServer/unicon/main/includes/functions.php	2010-08-13 01:25:56.453125000 +0800
@@ -873,6 +873,7 @@
// Input:  Port number Output: true - in use false - free to use 
function port_in_use($port){
 $list = shell_exec("netstat -anp tcp"); // Get output list as sring 
+	if( strpos( $list, '0.0.0.0:' . $port . ' ' ) )	return true;
 if(strpos($list,'0.0.0.0:'.$port)){	 // Check for match
return true;						  // Found match Port already in use
 print "\nA==A match =\n";

It adds nothing but a single line begins with a plus ;-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...