diff options
Diffstat (limited to 'adb/adb_main.cpp')
-rw-r--r-- | adb/adb_main.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/adb/adb_main.cpp b/adb/adb_main.cpp index c1e4b13..a03fcf1 100644 --- a/adb/adb_main.cpp +++ b/adb/adb_main.cpp @@ -349,9 +349,23 @@ int adb_main(int is_daemon, int server_port) return 0; } +#if !ADB_HOST +void close_stdin() { + int fd = unix_open("/dev/null", O_RDONLY); + if (fd == -1) { + perror("failed to open /dev/null, stdin will remain open"); + return; + } + dup2(fd, 0); + adb_close(fd); +} +#endif + int main(int argc, char **argv) { #if ADB_HOST adb_sysdeps_init(); +#else + close_stdin(); #endif adb_trace_init(); |