poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / strncpy.texi
blob1bd3256ba7b763d5109d7e035e8352f971ff1b5f
1 @node strncpy
2 @section @code{strncpy}
3 @findex strncpy
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncpy.html}
7 Gnulib module: string
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function cannot be called from plain inline or extern inline functions
13 on some platforms:
14 OS X 10.8.
15 @end itemize
17 Portability problems not fixed by Gnulib:
18 @itemize
19 @end itemize
21 Note: This function was designed for the use-case of filling a fixed-size
22 record with a string, before writing it to a file.  This function is
23 @strong{not} appropriate for copying a string into a bounded memory area,
24 because you have no guarantee that the result will be NUL-terminated.
25 Even if you add the NUL byte at the end yourself, this function is
26 inefficient (as it spends time clearing unused memory) and will allow
27 silent truncation to occur, which is not a good behavior for GNU programs.
28 For more details, see @url{https://meyering.net/crusade-to-eliminate-strncpy/}.