mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
vfs_fruit: prepare fruit_pread_meta() for reading on fake-fd
If the read on the stream fails we may have hit a handle on a just created stream (fio->created=true) with no data written yet. If that's the case return an empty initialized FinderInfo blob. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
4a5c9a9e73
commit
d7d9271071
@ -4194,8 +4194,7 @@ static ssize_t fruit_pread_meta_stream(vfs_handle_struct *handle,
|
||||
int ret;
|
||||
|
||||
nread = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
|
||||
|
||||
if (nread == n) {
|
||||
if (nread == -1 || nread == n) {
|
||||
return nread;
|
||||
}
|
||||
|
||||
@ -4299,6 +4298,25 @@ static ssize_t fruit_pread_meta(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nread == -1 && fio->created) {
|
||||
AfpInfo *ai = NULL;
|
||||
char afpinfo_buf[AFP_INFO_SIZE];
|
||||
|
||||
ai = afpinfo_new(talloc_tos());
|
||||
if (ai == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
nread = afpinfo_pack(ai, afpinfo_buf);
|
||||
TALLOC_FREE(ai);
|
||||
if (nread != AFP_INFO_SIZE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(data, afpinfo_buf, to_return);
|
||||
return to_return;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user