diff options
author | Jeremy Allison <jra@samba.org> | 2003-01-08 21:42:53 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-01-08 21:42:53 +0000 |
commit | 38aee23f807dad93fb832d97deac57d528a2a175 (patch) | |
tree | 8ac8b73162e8722ef8078f6f2e77a56f8b6dcb5c /source3/smbd/server.c | |
parent | 82ecfb97475e8c7a524acc43f8232a8dcd3c120c (diff) | |
download | samba-38aee23f807dad93fb832d97deac57d528a2a175.tar.gz samba-38aee23f807dad93fb832d97deac57d528a2a175.tar.xz samba-38aee23f807dad93fb832d97deac57d528a2a175.zip |
Ensure we don't get an invalid number for total smbd's if the tdb update
fails.
Jeremy.
(This used to be commit e0482594724ebba801bbc39a90a73fafa54f8b9e)
Diffstat (limited to 'source3/smbd/server.c')
-rw-r--r-- | source3/smbd/server.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index c5474a46b8..6ed2cdac96 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -526,12 +526,28 @@ static BOOL dump_core(void) update the current smbd process count ****************************************************************************/ -static void decrement_smbd_process_count(void) +static BOOL process_count_update_successful = False; + +int32 increment_smbd_process_count(void) { int32 total_smbds; if (lp_max_smbd_processes()) { total_smbds = 0; + if (tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1) == -1) + return 1; + process_count_update_successful = True; + return total_smbds + 1; + } + return 1; +} + +static void decrement_smbd_process_count(void) +{ + int32 total_smbds; + + if (lp_max_smbd_processes() && process_count_update_successful) { + total_smbds = 1; tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1); } } |