summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-06-13 11:11:39 +0200
committerJeremy Allison <jra@samba.org>2012-06-14 01:53:17 +0200
commit7e63e2230c25f0cbd3be7dcbbc29f0a26f9a5e90 (patch)
treef807ce7eac5590907a8d383130599678722068f9
parent6edb239f8ed724abaa594fbbac8c2eb6e485209e (diff)
downloadsamba-7e63e2230c25f0cbd3be7dcbbc29f0a26f9a5e90.tar.gz
samba-7e63e2230c25f0cbd3be7dcbbc29f0a26f9a5e90.tar.xz
samba-7e63e2230c25f0cbd3be7dcbbc29f0a26f9a5e90.zip
s3: Fix a comment
The fd count is implicit Signed-off-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jun 14 01:53:17 CEST 2012 on sn-devel-104
-rw-r--r--source3/locking/posix.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 2a274f9a00..02d9b6d3e3 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -392,12 +392,10 @@ bool posix_locking_end(void)
****************************************************************************/
/****************************************************************************
- The records in posix_pending_close_tdb are composed of an array of ints
- keyed by dev/ino pair.
- The first int is a reference count of the number of outstanding locks on
- all open fd's on this dev/ino pair. Any subsequent ints are the fd's that
- were open on this dev/ino pair that should have been closed, but can't as
- the lock ref count is non zero.
+ The records in posix_pending_close_db are composed of an array of
+ ints keyed by dev/ino pair. Those ints are the fd's that were open on
+ this dev/ino pair that should have been closed, but can't as the lock
+ ref count is non zero.
****************************************************************************/
/****************************************************************************
@@ -568,7 +566,8 @@ static void delete_windows_lock_ref_count(files_struct *fsp)
static void add_fd_to_close_entry(files_struct *fsp)
{
struct db_record *rec;
- uint8_t *new_data;
+ int *fds;
+ size_t num_fds;
NTSTATUS status;
TDB_DATA value;
@@ -579,19 +578,18 @@ static void add_fd_to_close_entry(files_struct *fsp)
SMB_ASSERT(rec != NULL);
value = dbwrap_record_get_value(rec);
+ SMB_ASSERT((value.dsize % sizeof(int)) == 0);
- new_data = talloc_array(rec, uint8_t,
- value.dsize + sizeof(fsp->fh->fd));
+ num_fds = value.dsize / sizeof(int);
+ fds = talloc_array(rec, int, num_fds+1);
- SMB_ASSERT(new_data != NULL);
+ SMB_ASSERT(fds != NULL);
- memcpy(new_data, value.dptr, value.dsize);
- memcpy(new_data + value.dsize,
- &fsp->fh->fd, sizeof(fsp->fh->fd));
+ memcpy(fds, value.dptr, value.dsize);
+ fds[num_fds] = fsp->fh->fd;
status = dbwrap_record_store(
- rec, make_tdb_data(new_data,
- value.dsize + sizeof(fsp->fh->fd)), 0);
+ rec, make_tdb_data((uint8_t *)fds, talloc_get_size(fds)), 0);
SMB_ASSERT(NT_STATUS_IS_OK(status));