summaryrefslogtreecommitdiff
path: root/libexec/ld.so/powerpc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2000-10-19 02:44:17 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2000-10-19 02:44:17 +0000
commit001103cbad49d5c127451ee05c7f572a65f0407e (patch)
tree014e644dd7d1472803346916e64564127ac510bd /libexec/ld.so/powerpc
parentd047b28c860cb917a63e0e7ee08bb962248ff82e (diff)
Fix bug in dl_strcmp, it is not always legal to access a pointer
at offset -1, the code that was here was very odd, the corrected code was basically copied from the libsa version.
Diffstat (limited to 'libexec/ld.so/powerpc')
-rw-r--r--libexec/ld.so/powerpc/archdep.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h
index 005c3cd75d2..3e87fb34212 100644
--- a/libexec/ld.so/powerpc/archdep.h
+++ b/libexec/ld.so/powerpc/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.2 2000/10/01 00:54:35 rahnds Exp $ */
+/* $OpenBSD: archdep.h,v 1.3 2000/10/19 02:44:16 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -124,18 +124,24 @@ _dl_strcpy(char *d, const char *s)
static inline int
_dl_strncmp(const char *d, const char *s, int c)
{
- while(c-- && *d && *d++ == *s++) {};
+ while(c-- && *d && *d == *s) {
+ d++;
+ s++;
+ };
if(c < 0) {
return(0);
}
- return(d[-1] - s[-1]);
+ return(*d - *s);
}
static inline int
_dl_strcmp(const char *d, const char *s)
{
- while(*d && *d++ == *s++) {};
- return(d[-1] - s[-1]);
+ while(*d && *d == *s) {
+ d++;
+ s++;
+ }
+ return(*d - *s);
}
static inline const char *