Permalink
Browse files

When yaws_ctl checks the CTL file to see if any current instance

is running, check the socket opened to the port read from the CTL
file to verify that the ephemeral port for that socket is not the
same as the port read from the CTL file. This avoids a false positive
caused by connecting the socket to its own port.


git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@1392 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 814bae1 commit 4cf79779dfdb4ffe0517ee117462c9bb155ccc43 @vinoski vinoski committed Feb 16, 2009
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/yaws_ctl.erl
View
@@ -310,7 +310,12 @@ connect_file(CtlFile) ->
binary,
{packet, 2}], 2000) of
{ok, Socket} ->
- {ok, Socket, Key};
+ case inet:port(Socket) of
+ Port ->
+ {error, erefused};
+ _ ->
+ {ok, Socket, Key}
+ end;
Err ->
Err
end;

0 comments on commit 4cf7977

Please sign in to comment.