summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/errmap_unix.c12
-rw-r--r--source3/smbd/reply.c4
2 files changed, 12 insertions, 4 deletions
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 8194cf80cc..2cd2386c5c 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -107,8 +107,16 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
{
int i = 0;
- if (unix_error == 0)
- return NT_STATUS_OK;
+ if (unix_error == 0) {
+ /* we map this to an error, not success, as this
+ function is only called in an error path. Lots of
+ our virtualised functions may fail without making a
+ unix system call that fails (such as when they are
+ checking for some handle existing), so unix_error
+ may be unset
+ */
+ return NT_STATUS_UNSUCCESSFUL;
+ }
/* Look through list */
while(unix_dos_nt_errmap[i].unix_error != 0) {
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 80afd582f6..d32d998da8 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2527,7 +2527,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
TALLOC_FREE(dir_hnd);
}
- if (count == 0 && NT_STATUS_IS_OK(status)) {
+ if (count == 0 && NT_STATUS_IS_OK(status) && errno != 0) {
status = map_nt_error_from_unix(errno);
}
@@ -5910,7 +5910,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
}
TALLOC_FREE(dir_hnd);
- if (count == 0 && NT_STATUS_IS_OK(status)) {
+ if (count == 0 && NT_STATUS_IS_OK(status) && errno != 0) {
status = map_nt_error_from_unix(errno);
}