diff options
author | Alin Gabriel Serdean <aserdean@ovn.org> | 2018-04-30 23:44:00 +0300 |
---|---|---|
committer | Alin Gabriel Serdean <aserdean@ovn.org> | 2018-05-08 18:28:51 +0300 |
commit | 5fffa669a7c14952305bd923ad423d6839fc3bf2 (patch) | |
tree | 2cc9fabe88c8b0025bbfa020f084d75b74b73b70 /lib | |
parent | 09f37a1b855bb2e774fa6b75405083977fdc3aa2 (diff) | |
download | openvswitch-5fffa669a7c14952305bd923ad423d6839fc3bf2.tar.gz |
windows: Fix return value in case of named pipe send failure
Named pipes should emulate UNIX socket behavior.
Until now the named pipes returned WSA (Windows implementation of BSD sockets
errors) return codes, for send errors.
In case of a disconnected named pipe (UNIX socket) send error, we should return
EPIPE.
Fixes: `check_logs` transient errors when checking for EPIPE.
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stream-windows.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stream-windows.c b/lib/stream-windows.c index d908ee972..34bc610b6 100644 --- a/lib/stream-windows.c +++ b/lib/stream-windows.c @@ -308,7 +308,7 @@ windows_send(struct stream *stream, const void *buffer, size_t n) || last_error == ERROR_NO_DATA || last_error == ERROR_BROKEN_PIPE) { /* If the pipe was disconnected, return connection reset. */ - return -WSAECONNRESET; + return -EPIPE; } else { VLOG_ERR_RL(&rl, "Could not send data on named pipe. Last " "error: %s", ovs_lasterror_to_string()); @@ -321,7 +321,7 @@ windows_send(struct stream *stream, const void *buffer, size_t n) result = WriteFile(s->fd, buffer, n, &(DWORD)retval, ov); last_error = GetLastError(); - if (!result && GetLastError() == ERROR_IO_PENDING) { + if (!result && last_error == ERROR_IO_PENDING) { /* Mark the send operation as pending. */ s->write_pending = true; return -EAGAIN; @@ -330,7 +330,7 @@ windows_send(struct stream *stream, const void *buffer, size_t n) || last_error == ERROR_NO_DATA || last_error == ERROR_BROKEN_PIPE)) { /* If the pipe was disconnected, return connection reset. */ - return -WSAECONNRESET; + return -EPIPE; } else if (!result) { VLOG_ERR_RL(&rl, "Could not send data on synchronous named pipe. Last " "error: %s", ovs_lasterror_to_string()); |