From 9f19b3ec8dec1e9402e31172a74b72cd46d3da36 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 24 Feb 2011 12:34:31 -0500 Subject: [PATCH] fix backwards conditional in stpncpy this only made the function unnecessarily slow on systems with unaligned access, but would of course crash on systems that can't do unaligned accesses (none of which have ports yet). --- src/string/stpncpy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string/stpncpy.c b/src/string/stpncpy.c index a877f5fe..473db17e 100644 --- a/src/string/stpncpy.c +++ b/src/string/stpncpy.c @@ -14,7 +14,7 @@ char *__stpncpy(char *d, const char *s, size_t n) size_t *wd; const size_t *ws; - if (((uintptr_t)s & ALIGN) != ((uintptr_t)d & ALIGN)) { + if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); if (!n || !*s) goto tail; wd=(void *)d; ws=(const void *)s; -- 2.25.1