summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-29 08:38:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:01 -0500
commit09d0b152b7bd85aa01898af81bd166a7673ab886 (patch)
tree6bebf9648412322c15b2b8a5777aa67c3a09d463 /source4/libcli
parent98052096e3150c2b1a3d31fc6fcc1dbc0d7a3067 (diff)
downloadsamba-09d0b152b7bd85aa01898af81bd166a7673ab886.tar.gz
samba-09d0b152b7bd85aa01898af81bd166a7673ab886.tar.bz2
samba-09d0b152b7bd85aa01898af81bd166a7673ab886.zip
r3360: improved the deletion of tmp files. smbd now puts all tmp files in var/locks/smbd.tmp/
and deletes that dir on startup. (This used to be commit 7e942e7f1bd2c293a0e6648df43a96f8b8a2a295)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/unexpected.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/source4/libcli/unexpected.c b/source4/libcli/unexpected.c
index 19a02bdeb8..264b9d7b33 100644
--- a/source4/libcli/unexpected.c
+++ b/source4/libcli/unexpected.c
@@ -44,15 +44,13 @@ void unexpected_packet(struct packet_struct *p)
struct unexpected_key key;
char buf[1024];
int len=0;
- TALLOC_CTX *mem_ctx;
if (!tdbd) {
- mem_ctx = talloc_init("receive_unexpected");
- if (!mem_ctx) return;
- tdbd = tdb_wrap_open(NULL, lock_path(mem_ctx, "unexpected.tdb"), 0,
+ char *path = smbd_tmp_path(NULL, "unexpected.tdb");
+ tdbd = tdb_wrap_open(NULL, path, 0,
TDB_DEFAULT,
O_RDWR | O_CREAT, 0644);
- talloc_destroy(mem_ctx);
+ talloc_free(path);
if (!tdbd) {
return;
}
@@ -150,13 +148,12 @@ struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
const char *mailslot_name)
{
struct tdb_wrap *tdb2;
- TALLOC_CTX *mem_ctx;
+ char *path;
- mem_ctx = talloc_init("receive_unexpected");
- if (!mem_ctx) return NULL;
- tdb2 = tdb_wrap_open(mem_ctx, lock_path(mem_ctx, "unexpected.tdb"), 0, 0, O_RDONLY, 0);
+ path = smbd_tmp_path(NULL, "unexpected.tdb");
+ tdb2 = tdb_wrap_open(NULL, path, 0, 0, O_RDONLY, 0);
+ talloc_free(path);
if (!tdb2) {
- talloc_destroy(mem_ctx);
return NULL;
}
@@ -167,7 +164,7 @@ struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
tdb_traverse(tdb2->tdb, traverse_match, NULL);
- talloc_destroy(mem_ctx);
+ talloc_free(tdb2);
return matched_packet;
}