summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/smbd/files.c8
-rw-r--r--source3/smbd/server.c7
3 files changed, 10 insertions, 7 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 88cb2c1fff..5cdb956974 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4753,7 +4753,7 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
void file_close_conn(connection_struct *conn);
void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
int vuid);
-void file_init(void);
+bool file_init(struct smbd_server_connection *sconn);
void file_close_user(struct smbd_server_connection *sconn, int vuid);
struct files_struct *files_forall(
struct smbd_server_connection *sconn,
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 05b22dcd7c..4d9e4f1f81 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -172,7 +172,7 @@ void file_close_pid(struct smbd_server_connection *sconn, uint16 smbpid,
Initialise file structures.
****************************************************************************/
-void file_init(void)
+bool file_init(struct smbd_server_connection *sconn)
{
int request_max_open_files = lp_max_open_files();
int real_lim;
@@ -197,12 +197,12 @@ void file_init(void)
SMB_ASSERT(real_max_open_files > 100);
- file_bmap = bitmap_talloc(talloc_autofree_context(),
- real_max_open_files);
+ file_bmap = bitmap_talloc(sconn, real_max_open_files);
if (!file_bmap) {
- exit_server("out of memory in file_init");
+ return false;
}
+ return true;
}
/****************************************************************************
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 6cc7907cbb..ff59b3dbaf 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -794,8 +794,6 @@ static bool init_structs(void )
if (!init_names())
return False;
- file_init();
-
if (!secrets_init())
return False;
@@ -1168,6 +1166,11 @@ extern void build_options(bool screen);
return -1;
}
+ if (!file_init(smbd_server_conn)) {
+ DEBUG(0, ("ERROR: file_init failed\n"));
+ return -1;
+ }
+
/*
* Initialize spoolss with an init function to convert printers first.
* static_init_rpc will try to initialize the spoolss server too but you