Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d396dc93 authored by Spencer Low's avatar Spencer Low
Browse files

adb: win32: fix daemon acknowledgement



The daemon failed to startup because main.cpp was changed from calling
WriteFile() to android::base::WriteStringToFd(), the later which calls
write() in the C Runtime which by default has stdout in textmode which
does \n to \r\n translation.

The quick fix is to change stdout's mode from text to binary since right
after it is reopened to redirect to the daemon log file anyway.

Change-Id: I322fc9eae5d6abbf63f3d5917b0beb2171b5a15c
Signed-off-by: default avatarSpencer Low <CompareAndSwap@gmail.com>
parent 85abaf66
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -156,6 +156,10 @@ int adb_main(int is_daemon, int server_port) {
        // TODO(danalbert): Why do we use stdout for Windows?
#if defined(_WIN32)
        int reply_fd = STDOUT_FILENO;
        // Change stdout mode to binary so \n => \r\n translation does not
        // occur. In a moment stdout will be reopened to the daemon log file
        // anyway.
        _setmode(reply_fd, _O_BINARY);
#else
        int reply_fd = STDERR_FILENO;
#endif