adb: win32: fix logging to adb.log

In the adb client, redirect stdin and stderr of the adb server to `nul',
so that when the adb server starts up, it avoids issues in the C Runtime
where it closes stderr, making it hard to properly reopen. There are
probably other ways to avoid this issue, but I think this is the
cleanest that will keep working over the years and will exercise the
most commonly used code-paths in the C Runtime.

Fix some adb_close() calls to be unix_close() (only really matters on
Windows).

Make stderr non-buffered on Windows, to match the (sensible) Linux
behavior.

Change-Id: I1b15c64240e50dbeb56788b0d0d901f4536ad788
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2 files changed