Skip to content

Commit

Permalink
Fix cancel_fd handling under non-Windows
Browse files Browse the repository at this point in the history
In commit caf8deb ("use recv() and closesocket() on the cmd_fd on windows")
I tried to reduce the use if #ifdef by using recv() everywhere. That was
wrong, because we can't use recv() on a pipe. Put it back how Nikos had it
in the first place.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 22, 2014
1 parent f8c1c09 commit eecb72c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ssl.c
Expand Up @@ -628,9 +628,13 @@ void check_cmd_fd(struct openconnect_info *vpninfo, fd_set *fds)
return;
}

#ifdef _WIN32
if (recv(vpninfo->cmd_fd, &cmd, 1, 0) != 1)
return;

#else
if (read(vpninfo->cmd_fd, &cmd, 1) != 1)
return;
#endif
switch (cmd) {
case OC_CMD_CANCEL:
case OC_CMD_DETACH:
Expand Down

0 comments on commit eecb72c

Please sign in to comment.