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

Commit d1007a8d authored by Tao Wu's avatar Tao Wu Committed by android-build-merger
Browse files

Merge "Ignore setsid error in some cases." am: 3562fd0f am: 324acdce am: f7756b89

am: 0e0cf74c

Change-Id: Ied835a23553a01c8cfe575f765f00e3a765484aa
parents 8dac9778 0e0cf74c
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -129,7 +129,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
        // 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
        // that a ctrl-c between the "starting server" and "done starting server" messages
        // gets a chance to terminate the server.
        // 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));
            fatal("setsid() failed: %s", strerror(errno));
        }
        }
#endif
#endif