| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: paths.c,v 1.41 2013/05/06 08:02:20 skrll Exp $ */ | | 1 | /* $NetBSD: paths.c,v 1.42 2016/01/24 01:56:04 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1996 Matt Thomas <matt@3am-software.com> | | 4 | * Copyright 1996 Matt Thomas <matt@3am-software.com> |
5 | * Copyright 2002 Charles M. Hannum <root@ihack.net> | | 5 | * Copyright 2002 Charles M. Hannum <root@ihack.net> |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -20,46 +20,45 @@ | | | @@ -20,46 +20,45 @@ |
20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | #ifndef lint | | 32 | #ifndef lint |
33 | __RCSID("$NetBSD: paths.c,v 1.41 2013/05/06 08:02:20 skrll Exp $"); | | 33 | __RCSID("$NetBSD: paths.c,v 1.42 2016/01/24 01:56:04 christos Exp $"); |
34 | #endif /* not lint */ | | 34 | #endif /* not lint */ |
35 | | | 35 | |
36 | #include <err.h> | | 36 | #include <err.h> |
37 | #include <errno.h> | | 37 | #include <errno.h> |
38 | #include <fcntl.h> | | 38 | #include <fcntl.h> |
39 | #include <stdarg.h> | | 39 | #include <stdarg.h> |
40 | #include <stdio.h> | | 40 | #include <stdio.h> |
41 | #include <stdlib.h> | | 41 | #include <stdlib.h> |
42 | #include <string.h> | | 42 | #include <string.h> |
43 | #include <unistd.h> | | 43 | #include <unistd.h> |
44 | #include <sys/types.h> | | 44 | #include <sys/types.h> |
45 | #include <sys/param.h> | | 45 | #include <sys/param.h> |
46 | #include <sys/sysctl.h> | | 46 | #include <sys/sysctl.h> |
47 | #include <sys/mman.h> | | 47 | #include <sys/mman.h> |
48 | #include <sys/stat.h> | | 48 | #include <sys/stat.h> |
49 | #include <sys/gmon.h> | | 49 | #include <sys/gmon.h> |
50 | #include <sys/socket.h> | | 50 | #include <sys/socket.h> |
51 | #include <sys/mount.h> | | 51 | #include <sys/mount.h> |
52 | #include <sys/mbuf.h> | | | |
53 | #include <sys/resource.h> | | 52 | #include <sys/resource.h> |
54 | #include <machine/cpu.h> | | 53 | #include <machine/cpu.h> |
55 | | | 54 | |
56 | #include "debug.h" | | 55 | #include "debug.h" |
57 | #include "rtld.h" | | 56 | #include "rtld.h" |
58 | | | 57 | |
59 | static Search_Path *_rtld_find_path(Search_Path *, const char *, size_t); | | 58 | static Search_Path *_rtld_find_path(Search_Path *, const char *, size_t); |
60 | static Search_Path **_rtld_append_path(Search_Path **, Search_Path **, | | 59 | static Search_Path **_rtld_append_path(Search_Path **, Search_Path **, |
61 | const char *, const char *, const char *); | | 60 | const char *, const char *, const char *); |
62 | static void _rtld_process_mapping(Library_Xform **, const char *, | | 61 | static void _rtld_process_mapping(Library_Xform **, const char *, |
63 | const char *); | | 62 | const char *); |
64 | static char *exstrdup(const char *, const char *); | | 63 | static char *exstrdup(const char *, const char *); |
65 | static const char *getstr(const char **, const char *, const char *); | | 64 | static const char *getstr(const char **, const char *, const char *); |