This reverts commit
de493a3e3b5b8d54f62c45072e27f2fefd4af43a:
s3:locking: Remove dead code
Found by Coverity.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
dbwrap_do_locked() correctly returns saved_errno which is a possible
errno returned by close() inside fd_close_posix_fn().
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
int fd_close_posix(const struct files_struct *fsp)
{
+ int saved_errno = 0;
+ int ret;
NTSTATUS status;
if (!lp_locking(fsp->conn->params) ||
* Finally close the fd associated with this fsp.
*/
- return close(fsp_get_pathref_fd(fsp));
+ ret = close(fsp_get_pathref_fd(fsp));
+
+ if (ret == 0 && saved_errno != 0) {
+ errno = saved_errno;
+ ret = -1;
+ }
+
+ return ret;
}
/****************************************************************************