diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-11-11 14:51:02 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-11-11 14:51:02 +0000 |
commit | 47ac571b28414165099b6642cff5a275d8abf9ab (patch) | |
tree | 06216acf13137243216f9fcbe1244650fcfdc82b /libexec/ld.so/util.h | |
parent | e4fe4057bcd01bb2b4dc2ba258e532eec9419b9e (diff) |
Better fix to the library name parsing. now correctly handles
libpython2.2.so.0.0 vs libpython2.1.so.0.0. Clean up a potential
memory leak if the filename is not a valid library.
ok brad@
Diffstat (limited to 'libexec/ld.so/util.h')
-rw-r--r-- | libexec/ld.so/util.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libexec/ld.so/util.h b/libexec/ld.so/util.h index 6a027480919..54b3fffc09b 100644 --- a/libexec/ld.so/util.h +++ b/libexec/ld.so/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.16 2003/07/06 20:03:58 deraadt Exp $ */ +/* $OpenBSD: util.h,v 1.17 2003/11/11 14:51:01 drahn Exp $ */ /* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> @@ -144,4 +144,22 @@ _dl_strchr(const char *p, const int ch) /* NOTREACHED */ } +static inline char * +_dl_strstr(const char *s, const char *find) +{ + char c, sc; + size_t len; + if ((c = *find++) != 0) { + len = _dl_strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (_dl_strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} + #endif /*__DL_UTIL_H__*/ |