strncat is insufficient

Bill Torcaso wildbill at haddock.ima.isc.com
Mon Aug 27 23:35:06 AEST 1990


I recall a kernel guru telling me (in the Unix system-III era, which is
when the strn* functions appeared), that strncpy was used to copy a
filename into a 14-character long entry in a directory.  If the name was
shorter, it got NUL-extended.  Otherwise it filled the 14 chars and no
space was 'wasted' on the NUL byte.



More information about the Comp.std.c mailing list