mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3: VFS: Use SMB_VFS_FCNTL to set fd flags in open_file()
Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue Oct 8 09:57:19 UTC 2019 on sn-devel-184
This commit is contained in:
parent
5084a69de1
commit
0abd1189a6
@ -1327,7 +1327,7 @@ static NTSTATUS open_file(files_struct *fsp,
|
||||
* too. With blocking file descriptors this
|
||||
* does not happen.
|
||||
*/
|
||||
ret = set_blocking(fsp->fh->fd, true);
|
||||
ret = vfs_set_blocking(fsp, true);
|
||||
if (ret == -1) {
|
||||
status = map_nt_error_from_unix(errno);
|
||||
DBG_WARNING("Could not set fd to blocking: "
|
||||
|
@ -1230,6 +1230,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
|
||||
int vfs_set_filelen(files_struct *fsp, off_t len);
|
||||
int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len);
|
||||
int vfs_fill_sparse(files_struct *fsp, off_t len);
|
||||
int vfs_set_blocking(files_struct *fsp, bool set);
|
||||
off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n);
|
||||
const char *vfs_readdirname(connection_struct *conn, void *p,
|
||||
SMB_STRUCT_STAT *sbuf, char **talloced);
|
||||
|
@ -711,6 +711,37 @@ int vfs_fill_sparse(files_struct *fsp, off_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Set a fd into blocking/nonblocking mode through VFS
|
||||
*******************************************************************************/
|
||||
|
||||
int vfs_set_blocking(files_struct *fsp, bool set)
|
||||
{
|
||||
int val;
|
||||
#ifdef O_NONBLOCK
|
||||
#define FLAG_TO_SET O_NONBLOCK
|
||||
#else
|
||||
#ifdef SYSV
|
||||
#define FLAG_TO_SET O_NDELAY
|
||||
#else /* BSD */
|
||||
#define FLAG_TO_SET FNDELAY
|
||||
#endif
|
||||
#endif
|
||||
val = SMB_VFS_FCNTL(fsp, F_GETFL, 0);
|
||||
if (val == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (set) {
|
||||
val &= ~FLAG_TO_SET;
|
||||
} else {
|
||||
val |= FLAG_TO_SET;
|
||||
}
|
||||
|
||||
return SMB_VFS_FCNTL(fsp, F_SETFL, val);
|
||||
#undef FLAG_TO_SET
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Transfer some data (n bytes) between two file_struct's.
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user