On Sat, Nov 07, 2015 at 08:42:14PM -0500, Ted Unangst wrote:
> Tobias Stoeckmann wrote:
> > Is this okay for ssh and tmux, which are out to be very portable?
> > Nicholas mentioned that malloc is not required to set errno. I've also
> > checked the standard and it's just an extension. Although at worst,
> > the user sees a wrong error message...
>
> Are they portable to not-posix? posix dictates that malloc set errno.
It is optional in SUSv3:
RETURN VALUE
Upon successful completion with size not equal to 0, malloc() shall
return a pointer to the allocated space. If size is 0, either
a null pointer or a unique pointer that can be successfully
passed to free() shall be returned. Otherwise, it shall return
a null pointer ^[CX] [Option Start] and set errno to indicate
the error. [Option End]