From 6d15ca3482bfdccd9eceef1874f88ec351e3f43f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 13 Dec 2011 14:58:50 +0100 Subject: [PATCH] s3:smbd/globals: change 'int am_parent' into 'struct smbd_parent_context *am_parent' This is a short term solution on the way to get rid of 'am_parent' completely. metze --- source3/smbd/globals.c | 2 +- source3/smbd/globals.h | 3 ++- source3/smbd/server.c | 17 +++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index 82de70a388a..274f017b08d 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -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; diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 559f8fb24eb..020e1bcddeb 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -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; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 7cd1b833263..779bbba1fa0 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -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, -- 2.34.1