summaryrefslogtreecommitdiff
path: root/source3/utils/smbcontrol.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-05-15 01:28:34 +0000
committerAndrew Tridgell <tridge@samba.org>2001-05-15 01:28:34 +0000
commit98da4768df0939611bdfe7fb919c111013bc960a (patch)
tree19ac132286eda8ab9e1d1093175c9689efb81123 /source3/utils/smbcontrol.c
parent8410ef028a5eefb257346b6023a0e96c3cca1012 (diff)
downloadsamba-98da4768df0939611bdfe7fb919c111013bc960a.tar.gz
samba-98da4768df0939611bdfe7fb919c111013bc960a.tar.bz2
samba-98da4768df0939611bdfe7fb919c111013bc960a.zip
remember to close tdb after use
(This used to be commit 8f8d7202cf6e12cdb2f4445ddcac83a7ac9e33a2)
Diffstat (limited to 'source3/utils/smbcontrol.c')
-rw-r--r--source3/utils/smbcontrol.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 5bb4e602f0..30861030d8 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -125,17 +125,21 @@ send a message to a named destination
static BOOL send_message(char *dest, int msg_type, void *buf, int len, BOOL duplicates)
{
pid_t pid;
- TDB_CONTEXT *the_tdb;
-
- the_tdb = tdb_open(lock_path("connections.tdb"), 0, 0, O_RDONLY, 0);
- if (!the_tdb) {
- fprintf(stderr,"Failed to open connections database in send_message.\n");
- return False;
- }
-
/* "smbd" is the only broadcast operation */
if (strequal(dest,"smbd")) {
- return message_send_all(the_tdb,msg_type, buf, len, duplicates);
+ TDB_CONTEXT *tdb;
+ BOOL ret;
+
+ tdb = tdb_open(lock_path("connections.tdb"), 0, 0, O_RDONLY, 0);
+ if (!tdb) {
+ fprintf(stderr,"Failed to open connections database in send_message.\n");
+ return False;
+ }
+
+ ret = message_send_all(tdb,msg_type, buf, len, duplicates);
+ tdb_close(tdb);
+
+ return ret;
} else if (strequal(dest,"nmbd")) {
pid = pidfile_pid(dest);
if (pid == 0) {