From 15e66ba37ae56787897e49039e217b5426924829 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 25 May 2001 00:48:28 +0000 Subject: Added tdb_change_int_atomic() to allow atomic updates of a tdb int value. Jeremy. (This used to be commit cf5015f15935605cf69078bc15251db61ddc48c7) --- source3/smbd/process.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/smbd/process.c') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 74c0cbc96f..1f575e2a46 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -781,12 +781,12 @@ static BOOL smbd_process_limit(void) /* Always add one to the smbd process count, as exit_server() always * subtracts one. */ - tdb_lock_bystring(conn_tdb_ctx(), "INFO/total_smbds"); - total_smbds = tdb_fetch_int(conn_tdb_ctx(), "INFO/total_smbds"); - total_smbds = total_smbds < 0 ? 1 : total_smbds + 1; - tdb_store_int(conn_tdb_ctx(), "INFO/total_smbds", total_smbds); - tdb_unlock_bystring(conn_tdb_ctx(), "INFO/total_smbds"); - + + total_smbds = 1; /* In case we need to create the entry. */ + + if (tdb_change_int_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, 1) == -1) + return True; + return total_smbds > lp_max_smbd_processes(); } else -- cgit