1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00

s3: VFS: shadow_copy2: Code cleanup. In shadow_copy2_get_shadow_copy_data() preserve errno accross cleanup syscalls.

This VFS function should really return an NTSTATUS but that is
a patch for another day.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2021-06-07 09:44:23 -07:00 committed by Ralph Boehme
parent 250a5df6bc
commit a80456e61d

View File

@ -1977,6 +1977,7 @@ static int shadow_copy2_get_shadow_copy_data(
int fd;
int ret = -1;
NTSTATUS status;
int saved_errno = 0;
snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle, fsp->fsp_name);
if (snapdir == NULL) {
@ -2136,6 +2137,9 @@ static int shadow_copy2_get_shadow_copy_data(
ret = 0;
done:
if (ret != 0) {
saved_errno = errno;
}
TALLOC_FREE(fspcwd );
if (p != NULL) {
SMB_VFS_NEXT_CLOSEDIR(handle, p);
@ -2153,6 +2157,9 @@ done:
file_free(NULL, dirfsp);
}
TALLOC_FREE(tmp_ctx);
if (saved_errno != 0) {
errno = saved_errno;
}
return ret;
}