musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/string
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011年02月24日 12:34:31 -0500
committerRich Felker <dalias@aerifal.cx>2011年02月24日 12:34:31 -0500
commit9f19b3ec8dec1e9402e31172a74b72cd46d3da36 (patch)
treeeec1213b1fa6d1bc5f89bf18eccfd06e675ccbf3 /src/string
parenta6238c30d169cbac6bc4c4977622242063e32270 (diff)
downloadmusl-9f19b3ec8dec1e9402e31172a74b72cd46d3da36.tar.gz
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).
Diffstat (limited to 'src/string')
-rw-r--r--src/string/stpncpy.c 2
1 files changed, 1 insertions, 1 deletions
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;
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月06日 10:15:39 +0000

AltStyle によって変換されたページ (->オリジナル) /