So, it always writes
n
characters, regardless of how short the source might be, and if it stops at the specified upper bound, the result isn't a valid C string. Strange thing is that
strlcpy
has been around forever, works about as sensibly as anything working with C strings can, but as far as I know nobody's ever even written a paper suggesting that the standard include it.