Revision
147
Author
robert@fledge.watson.org
Date
2009-11-10 05:08:05 -0800 (Tue, 10 Nov 2009)

Log Message

Use memcpy() in preference to strlcpy() for portability reasons, which
also zeros out padding.

Minor style tweak to submitted patch: treat sizeof() as a function as
appears to be the style elsewhere in libdispatch.

Submitted by:	Paolo Bonzini <bonzini@gnu.org>

Modified Paths

Diff

Modified: trunk/src/source.c (146 => 147)


--- trunk/src/source.c	2009-11-10 11:52:23 UTC (rev 146)
+++ trunk/src/source.c	2009-11-10 13:08:05 UTC (rev 147)
@@ -1096,6 +1096,7 @@
 {
 	const struct kevent *proto_kev = &type->ke;
 	dispatch_source_t ds = NULL;
+	static char source_label[sizeof(ds->dq_label)] = "source";
 	dispatch_kevent_t dk = NULL;
 
 	// input validation
@@ -1139,7 +1140,7 @@
 
 	// Initialize as a queue first, then override some settings below.
 	_dispatch_queue_init((dispatch_queue_t)ds);
-	strlcpy(ds->dq_label, "source", sizeof(ds->dq_label));
+	memcpy(ds->dq_label, source_label, sizeof(source_label));
 
 	// Dispatch Object
 	ds->do_vtable = &_dispatch_source_kevent_vtable;