summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c9
-rw-r--r--source3/locking/posix.c14
2 files changed, 15 insertions, 8 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index d2e8b7ef59..39cc991b5f 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -81,7 +81,7 @@ BOOL is_locked(files_struct *fsp,
enum brl_type lock_type)
{
int strict_locking = lp_strict_locking(fsp->conn->params);
- enum brl_flavour lock_flav = lp_posix_cifsu_locktype();
+ enum brl_flavour lock_flav = lp_posix_cifsu_locktype(fsp);
BOOL ret = True;
if (count == 0) {
@@ -426,13 +426,14 @@ char *share_mode_str(int num, struct share_mode_entry *e)
slprintf(share_str, sizeof(share_str)-1, "share_mode_entry[%d]: %s "
"pid = %s, share_access = 0x%x, private_options = 0x%x, "
"access_mask = 0x%x, mid = 0x%x, type= 0x%x, file_id = %lu, "
- "uid = %u, dev = 0x%x, inode = %.0f",
+ "uid = %u, flags = %u, dev = 0x%x, inode = %.0f",
num,
e->op_type == UNUSED_SHARE_MODE_ENTRY ? "UNUSED" : "",
procid_str_static(&e->pid),
e->share_access, e->private_options,
e->access_mask, e->op_mid, e->op_type, e->share_file_id,
- (unsigned int)e->uid, (unsigned int)e->dev, (double)e->inode );
+ (unsigned int)e->uid, (unsigned int)e->flags,
+ (unsigned int)e->dev, (double)e->inode );
return share_str;
}
@@ -912,6 +913,7 @@ static void fill_share_mode_entry(struct share_mode_entry *e,
e->inode = fsp->inode;
e->share_file_id = fsp->fh->file_id;
e->uid = (uint32)uid;
+ e->flags = fsp->posix_open ? SHARE_MODE_FLAG_POSIX_OPEN : 0;
}
static void fill_deferred_open_entry(struct share_mode_entry *e,
@@ -927,6 +929,7 @@ static void fill_deferred_open_entry(struct share_mode_entry *e,
e->dev = dev;
e->inode = ino;
e->uid = (uint32)-1;
+ e->flags = 0;
}
static void add_share_mode_entry(struct share_mode_lock *lck,
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 806018da81..62804eb8e3 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -636,7 +636,7 @@ static size_t get_posix_pending_close_entries(files_struct *fsp, int **entries)
to delete all locks on this fsp before this function is called.
****************************************************************************/
-int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
+NTSTATUS fd_close_posix(struct connection_struct *conn, files_struct *fsp)
{
int saved_errno = 0;
int ret;
@@ -651,7 +651,7 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
*/
ret = SMB_VFS_CLOSE(fsp,fsp->fh->fd);
fsp->fh->fd = -1;
- return ret;
+ return map_nt_error_from_unix(errno);
}
if (get_windows_lock_ref_count(fsp)) {
@@ -663,7 +663,7 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
add_fd_to_close_entry(fsp);
fsp->fh->fd = -1;
- return 0;
+ return NT_STATUS_OK;
}
/*
@@ -701,14 +701,18 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
ret = SMB_VFS_CLOSE(fsp,fsp->fh->fd);
- if (saved_errno != 0) {
+ if (ret == 0 && saved_errno != 0) {
errno = saved_errno;
ret = -1;
}
fsp->fh->fd = -1;
- return ret;
+ if (ret == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+
+ return NT_STATUS_OK;
}
/****************************************************************************