[PATCH xscope] Use strncpy rather than strlcpy as it is not available on Linux

Gaetan Nadon memsize at videotron.ca
Wed Jun 9 10:51:23 PDT 2010


From: Gaetan Nadon <nadon at IBMT43.(none)>

Because it is available on other platforms, it only fails on Linux.
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 <memsize at videotron.ca>
---
 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;
-- 
1.6.3.3



More information about the xorg-devel mailing list