diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-28 14:11:45 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-28 14:11:45 +0100 |
commit | 76d6c43ef28ef06d8b2e603da0fa8e5c6faf5fdd (patch) | |
tree | 69042d3212d9046f65fe3123fb0f1b6b46dbfd8b /source4/ntvfs/common/opendb_tdb.c | |
parent | 517bf7aa4f77ac0ef421f960f5610b185f6e598e (diff) | |
parent | c3ce0a0b95b6051a356c72424c2d62b77a0e81df (diff) | |
download | samba-76d6c43ef28ef06d8b2e603da0fa8e5c6faf5fdd.tar.gz samba-76d6c43ef28ef06d8b2e603da0fa8e5c6faf5fdd.tar.bz2 samba-76d6c43ef28ef06d8b2e603da0fa8e5c6faf5fdd.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
(This used to be commit 84b677285250d9b9a1120fcfd6e4bbbb8f939fe8)
Diffstat (limited to 'source4/ntvfs/common/opendb_tdb.c')
-rw-r--r-- | source4/ntvfs/common/opendb_tdb.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index a51c823a63..37c1c0850b 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -527,10 +527,12 @@ static NTSTATUS odb_tdb_open_file_pending(struct odb_lock *lck, void *private) /* remove a opendb entry */ -static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle) +static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle, + const char **_delete_path) { struct odb_context *odb = lck->odb; struct opendb_file file; + const char *delete_path = NULL; int i; NTSTATUS status; @@ -566,7 +568,16 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle) file.num_pending = 0; file.num_entries--; - + + if (file.num_entries == 0 && file.delete_on_close) { + delete_path = talloc_strdup(lck, file.path); + NT_STATUS_HAVE_NO_MEMORY(delete_path); + } + + if (_delete_path) { + *_delete_path = delete_path; + } + return odb_push_record(lck, &file); } @@ -723,20 +734,20 @@ static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, bool del_on_cl people still have the file open */ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb, - DATA_BLOB *key, bool *del_on_close, - int *open_count, char **path) + DATA_BLOB *key, bool *del_on_close) { NTSTATUS status; struct opendb_file file; struct odb_lock *lck; + (*del_on_close) = false; + lck = odb_lock(odb, odb, key); NT_STATUS_HAVE_NO_MEMORY(lck); status = odb_pull_record(lck, &file); if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) { talloc_free(lck); - (*del_on_close) = false; return NT_STATUS_OK; } if (!NT_STATUS_IS_OK(status)) { @@ -745,16 +756,6 @@ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb, } (*del_on_close) = file.delete_on_close; - if (open_count != NULL) { - (*open_count) = file.num_entries; - } - if (path != NULL) { - *path = talloc_strdup(odb, file.path); - NT_STATUS_HAVE_NO_MEMORY(*path); - if (file.num_entries == 1 && file.entries[0].delete_on_close) { - (*del_on_close) = true; - } - } talloc_free(lck); |