adb: fix shell_service_protocol_test for Windows.
Adds missing #ifdef guards to shell_service_protocol_test.cpp so the
test compiles on Windows.
Also fixes a bug in Windows socketpair write implementation. Previously
it was only checking for a closed pipe if the write happened to block.
This adds an additional pre-check to exit immediately on a closed pipe.
These two changes allow the test to compile and pass on Windows.
Change-Id: Ib8853ed72f015fc0d623da47c32982cb3ffa4a3d
diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp
index c5aad02..5b23c79 100644
--- a/adb/sysdeps_win32.cpp
+++ b/adb/sysdeps_win32.cpp
@@ -1121,6 +1121,11 @@
BIPD(( "bip_buffer_write: enter %d->%d len %d", bip->fdin, bip->fdout, len ));
BIPDUMP( src, len );
+ if (bip->closed) {
+ errno = EPIPE;
+ return -1;
+ }
+
EnterCriticalSection( &bip->lock );
while (!bip->can_write) {