EINVAL for out-of-range values. On error, POSIX permits buf to
be empty, unchanged, or unterminated, but these are not useful,
so we guarantee NUL-terminated truncated contents for all but
EINVAL for out-of-range values. On error, POSIX permits buf to
be empty, unchanged, or unterminated, but these are not useful,
so we guarantee NUL-terminated truncated contents for all but