summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2008-04-21 11:38:20 +0400
committerAlexander Bokovoy <ab@samba.org>2008-04-21 11:38:20 +0400
commitff615f232968979f57a31f43a4f668c2c4fd20df (patch)
tree8e4d6e1181001dd35e32008a3401020c013e288b /source3/locking
parent09caab9f37d6ecd4fd6fe9ce3c284730b232651a (diff)
parent0db7aba8af80a01150d1061a4192ab814e4234b7 (diff)
downloadsamba-ff615f232968979f57a31f43a4f668c2c4fd20df.tar.gz
samba-ff615f232968979f57a31f43a4f668c2c4fd20df.tar.bz2
samba-ff615f232968979f57a31f43a4f668c2c4fd20df.zip
Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
(This used to be commit 2c3ffc1c53550c8e6feeca8fc0270ef9ac1ec70a)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/posix.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 1b88c472b0..32e1ee9fbf 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -607,37 +607,34 @@ static size_t get_posix_pending_close_entries(TALLOC_CTX *mem_ctx,
to delete all locks on this fsp before this function is called.
****************************************************************************/
-NTSTATUS fd_close_posix(struct files_struct *fsp)
+int fd_close_posix(struct files_struct *fsp)
{
int saved_errno = 0;
int ret;
int *fd_array = NULL;
size_t count, i;
- if (!lp_locking(fsp->conn->params) || !lp_posix_locking(fsp->conn->params)) {
+ if (!lp_locking(fsp->conn->params) ||
+ !lp_posix_locking(fsp->conn->params))
+ {
/*
* No locking or POSIX to worry about or we want POSIX semantics
* which will lose all locks on all fd's open on this dev/inode,
* just close.
*/
- ret = SMB_VFS_CLOSE(fsp,fsp->fh->fd);
- fsp->fh->fd = -1;
- if (ret == -1) {
- return map_nt_error_from_unix(errno);
- }
- return NT_STATUS_OK;
+ return close(fsp->fh->fd);
}
if (get_windows_lock_ref_count(fsp)) {
/*
- * There are outstanding locks on this dev/inode pair on other fds.
- * Add our fd to the pending close tdb and set fsp->fh->fd to -1.
+ * There are outstanding locks on this dev/inode pair on
+ * other fds. Add our fd to the pending close tdb and set
+ * fsp->fh->fd to -1.
*/
add_fd_to_close_entry(fsp);
- fsp->fh->fd = -1;
- return NT_STATUS_OK;
+ return 0;
}
/*
@@ -648,10 +645,11 @@ NTSTATUS fd_close_posix(struct files_struct *fsp)
count = get_posix_pending_close_entries(talloc_tos(), fsp, &fd_array);
if (count) {
- DEBUG(10,("fd_close_posix: doing close on %u fd's.\n", (unsigned int)count ));
+ DEBUG(10,("fd_close_posix: doing close on %u fd's.\n",
+ (unsigned int)count));
for(i = 0; i < count; i++) {
- if (SMB_VFS_CLOSE(fsp,fd_array[i]) == -1) {
+ if (close(fd_array[i]) == -1) {
saved_errno = errno;
}
}
@@ -673,20 +671,14 @@ NTSTATUS fd_close_posix(struct files_struct *fsp)
* Finally close the fd associated with this fsp.
*/
- ret = SMB_VFS_CLOSE(fsp,fsp->fh->fd);
+ ret = close(fsp->fh->fd);
if (ret == 0 && saved_errno != 0) {
errno = saved_errno;
ret = -1;
- }
-
- fsp->fh->fd = -1;
-
- if (ret == -1) {
- return map_nt_error_from_unix(errno);
}
- return NT_STATUS_OK;
+ return ret;
}
/****************************************************************************