Merge "Ignore setsid error in some cases."

am: 3562fd0fa8

Change-Id: I8ff768ce0e4ddd5e2810e40302bf597e2f39387b
This commit is contained in:
Tao Wu 2016-09-22 08:22:14 +00:00 committed by android-build-merger
commit 324acdce69
1 changed files with 3 additions and 1 deletions

View File

@ -128,7 +128,9 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply
// Start a new session for the daemon. Do this here instead of after the fork so
// that a ctrl-c between the "starting server" and "done starting server" messages
// gets a chance to terminate the server.
if (setsid() == -1) {
// setsid will fail with EPERM if it's already been a lead process of new session.
// Ignore such error.
if (setsid() == -1 && errno != EPERM) {
fatal("setsid() failed: %s", strerror(errno));
}
#endif