Gaetan Nadon wrote: > Because it is available on other platforms, it only fails on Linux.
*sigh* is GNU libc ever going to get with the program? > strncpy should be safe enough in this situation where a constant is copied. > The xserver private impl of strlcpy is not available to apps. > > Signed-off-by: Gaetan Nadon <[email protected]> > --- > scope.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/scope.c b/scope.c > index e33c9d9..758fd19 100644 > --- a/scope.c > +++ b/scope.c > @@ -337,7 +337,7 @@ ReadCommands (void) > printf ("> "); > if (!fgets (line, sizeof line, stdin)) { > if(feof(stdin)) { > - strlcpy(line, "quit", sizeof(line)); > + strncpy(line, "quit", sizeof(line)); > } else { > printf("Error: %s\n", strerror(errno)); > break; Yeah, since line[1024] is always bigger than "quit" strncpy is safe. (So is strcpy for that matter, and it wouldn't write 1019 unnecessary bytes like strncpy, but you can only quit once, so performance isn't important here.) Reviewed-by: Alan Coopersmith <[email protected]> -- -Alan Coopersmith- [email protected] Oracle Solaris Platform Engineering: X Window System _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
