Copy:
[email protected]
Date: Sun, 21 Apr 2024 21:33:38 +0200
From: Pali <[email protected]>
Cc: [email protected]
+ /* Base address of the memory handle must be page aligned too. */ + if (d->address & 0xfff)
+ {
+ errno = EFAULT;
I think this should be EINVAL. An unaligned address is not really
"bad address", it's just that it's not valid for this function.
This is base address of the memory handle found by the DJGPP's __djgpp_memory_handle function. Not the address passed as input
parameter by caller. So I thought that EFAULT is better there.
+ case 0x8023: /* Invalid handle (in ESI) */
+ case 0x8025: /* Invalid linear address (specified range is not within specified block or EBX/EDX is not page-aligned) */
+ errno = EFAULT;
These two should also be EINVAL, IMO.
EFAULT errno is mostly returned when the passed pointer is invalid, e.g.
out of the process space. So I thought that EFAULT is better error code
than EINVAL for the case when the DPMI server say that it rejected
linear address. Linear address for this DPMI call is defined by the
handle and offset.
That is the reason why I chose these errno codes.
Maybe we should first agree what is "bad address", then? To me, it
means address that is outside of the program's address space, or
something that cannot be an address at all. That's not what happens
here.
Anyway, I used exactly same errno codes as in merged change for the __djgpp_set_page_attributes function. And I think that these two
functions should use same errno codes for common errors. So in case you
think that there should be EINVAL (and not EFAULT) then it should be
changed for both functions.
If agree about the above, then yes, they both should be modified.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)