s3:smbd: move exit_firsttime checking to the start of exit_server_common()
authorStefan Metzmacher <metze@samba.org>
Mon, 6 Jul 2020 14:42:46 +0000 (16:42 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 14 Jul 2020 13:38:35 +0000 (13:38 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14433

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/smbd/server_exit.c

index e3efa993159fcdaa30eb78afb843ee8bac67c554..01e3ef83f0315ce5fe0234925387b3558b8e62f5 100644 (file)
@@ -83,6 +83,11 @@ static void exit_server_common(enum server_exit_reason how,
        struct messaging_context *msg_ctx = global_messaging_context();
        NTSTATUS disconnect_status;
 
+       if (!exit_firsttime) {
+               exit(0);
+       }
+       exit_firsttime = false;
+
        switch (how) {
        case SERVER_EXIT_NORMAL:
                disconnect_status = NT_STATUS_LOCAL_DISCONNECT;
@@ -98,9 +103,6 @@ static void exit_server_common(enum server_exit_reason how,
                xconn = client->connections;
        }
 
-       if (!exit_firsttime)
-               exit(0);
-       exit_firsttime = false;
 
        change_to_root_user();