diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 4c807c3f85c..174f07b1159 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1474,6 +1474,8 @@ struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, O_RDONLY, &fsp); if (!NT_STATUS_IS_OK(status)) { + /* Ensure we return the actual error from status in errno. */ + errno = map_errno_from_nt_status(status); return NULL; }