On Thu, 2003-01-30 at 01:40, Ben Pfaff wrote: > As a result, strncpy() is hardly ever the right function to use. > strlcpy() from OpenBSD is usually a better choice. I don't understand the point of strlcpy() and strlcat() return value though. Can it really be used for anything else than checking if the value was truncated? Why not simply return -1 when it is? if (strocpy(dest, src, sizeof(dest)) < 0) { ... } vs. if (strlcpy(dest, src, sizeof(dest)) >= sizeof(dest)) { ... } Even worse if the size parameter is anything more complicated.
This archive was generated by hypermail 2b30 : Thu Jan 30 2003 - 09:25:46 PST