Closed emilbayes closed 6 years ago
Hi Emil,
_alloc_aligned()
will set errno
.
Merged, thanks a lot!
Ah ok! Still learning! I should have followed the code down mmap
, posix_memalign
and VirtualAlloc
. Good stuff to study :)
@jedisct1 Reading about VirtualAlloc
, should we check GetLastError
in sodium-native
on Windows like we check errno
on UNIX?
Mmmm... I don't know if VirtualAlloc()
also sets errno
or not. Might be worth checking. If it doesn't, maybe libsodium should set errno
, so that in applications, there's only one thing to check no matter what the platform is.
@jedisct1 The documentation doesn't indicate that it does, but I can't test it myself atm: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx
I don't have access to a Windows VM right now, so if you could test, that would be very useful!
Ah missing t. I will try to remember to check next time I have access to a windows machine
I found this by reading the source, however I'm not sure
errno
is always set. Following this code path, it seems thatNULL
may be returned, buterrno
is not set:https://github.com/jedisct1/libsodium/blob/69642f040935d9458ea3d2ba83696751c24bc13a/src/libsodium/sodium/utils.c#L538-L540