On the current page for `man 3 strncpy` there is an error in the sample for forced termination if the copy does not result in a proper null-terminated string. (Appears in both "Man-pages, release 3.58", and on http://man7.org/linux/man-pages/man3/strncpy.3.html ) Current: strncpy(buf, str, n); if (n > 0) buf[n - 1]= '\0'; If n == 4, then 4 bytes are copied, (buf[0] - buf[3]) but n - 1 or buf[3] is then overwritten with the '\0'. Should be buf[n] instead. Corrected code: strncpy(buf, str, n); if (n > 0) buf[n]= '\0'; Question: Even if n == 0 why shouldn't buf[n] be set to '\0'? Thank you! Rick Stanley -- RSI (Rick Stanley, Inc.) (917) 822-7771 www.rsiny.com Computer Systems Consulting Linux & Open Source Specialists -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html