mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
remember to close tdb after use
This commit is contained in:
parent
6bdbeb4a32
commit
8f8d7202cf
@ -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) {
|
||||
|
@ -327,6 +327,7 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st
|
||||
printf("----------------------------------------------\n");
|
||||
}
|
||||
tdb_traverse(tdb, traverse_fn1, NULL);
|
||||
tdb_close(tdb);
|
||||
|
||||
locks:
|
||||
if (processes_only) exit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user