s3:smbd/globals: change 'int am_parent' into 'struct smbd_parent_context *am_parent'
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 13:58:50 +0000 (14:58 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 14 Dec 2011 07:14:44 +0000 (08:14 +0100)
This is a short term solution on the way to get rid of 'am_parent' completely.

metze

source3/smbd/globals.c
source3/smbd/globals.h
source3/smbd/server.c

index 82de70a388a61da28d9f1a9f34fb898955e46955..274f017b08dc5f7f967ee0909f086209c9341340 100644 (file)
@@ -98,7 +98,7 @@ int32_t exclusive_oplocks_open = 0;
 int32_t level_II_oplocks_open = 0;
 struct kernel_oplocks *koplocks = NULL;
 
-int am_parent = 1;
+struct smbd_parent_context *am_parent = NULL;
 struct memcache *smbd_memcache_ctx = NULL;
 bool exit_firsttime = true;
 struct child_pid *children = 0;
index 559f8fb24eb7261c328311456d292b1934f6517c..020e1bcddeb090d7d77b20537143180733f70594 100644 (file)
@@ -113,7 +113,8 @@ extern int32_t exclusive_oplocks_open;
 extern int32_t level_II_oplocks_open;
 extern struct kernel_oplocks *koplocks;
 
-extern int am_parent;
+struct smbd_parent_context;
+extern struct smbd_parent_context *am_parent;
 extern struct memcache *smbd_memcache_ctx;
 extern bool exit_firsttime;
 struct child_pid;
index 7cd1b833263ee786671e0f7a1e740bd5a5592f7d..779bbba1fa0d46ca00fb658e5e23ab0eaf611cd5 100644 (file)
@@ -416,7 +416,14 @@ static void smbd_accept_connection(struct tevent_context *ev,
                NTSTATUS status = NT_STATUS_OK;
 
                /* Child code ... */
-               am_parent = 0;
+               am_parent = NULL;
+
+               /*
+                * Can't use TALLOC_FREE here. Nulling out the argument to it
+                * would overwrite memory we've just freed.
+                */
+               talloc_free(s->parent);
+               s = NULL;
 
                set_my_unique_id(unique_id);
 
@@ -430,13 +437,6 @@ static void smbd_accept_connection(struct tevent_context *ev,
                        close_low_fds(False); /* Don't close stderr */
                }
 
-               /*
-                * Can't use TALLOC_FREE here. Nulling out the argument to it
-                * would overwrite memory we've just freed.
-                */
-               talloc_free(s->parent);
-               s = NULL;
-
                status = reinit_after_fork(msg_ctx,
                                           ev,
                                           true);
@@ -1146,6 +1146,7 @@ extern void build_options(bool screen);
        parent->interactive = interactive;
        parent->ev_ctx = ev_ctx;
        parent->msg_ctx = msg_ctx;
+       am_parent = parent;
 
        se = tevent_add_signal(parent->ev_ctx,
                               parent,