This is subtle: generally fsp_set_fd(fd) is called in the caller of
SMB_VFS_OPENAT() in non_widelink_open().
fsp_set_fd() has a check that asserts certain combindations of the existing
fsp->fh->fd and the new fd. Both being valid fds is not allowed.
Therefor inside the VFS we must reset fsp->fh->fd if we've set it.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
if (fd == -1) {
return -1;
}
- fsp_set_fd(fsp, fd);
if ((flags & (O_CREAT|O_EXCL)) != (O_CREAT|O_EXCL)) {
return fd;
* We must have created the file.
*/
+ fsp_set_fd(fsp, fd);
ret = SMB_VFS_FSTAT(fsp, &sbuf);
+ fsp_set_fd(fsp, -1);
if (ret == -1) {
/* Can't happen... */
DBG_WARNING("SMB_VFS_FSTAT failed on file %s (%s)\n",