diff options
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/basename.c | 39 | ||||
-rw-r--r-- | openbsd-compat/daemon.c | 5 | ||||
-rw-r--r-- | openbsd-compat/dirname.c | 42 | ||||
-rw-r--r-- | openbsd-compat/getcwd.c | 4 | ||||
-rw-r--r-- | openbsd-compat/getgrouplist.c | 3 | ||||
-rw-r--r-- | openbsd-compat/glob.c | 6 | ||||
-rw-r--r-- | openbsd-compat/readpassphrase.c | 40 | ||||
-rw-r--r-- | openbsd-compat/realpath.c | 12 | ||||
-rw-r--r-- | openbsd-compat/strlcat.c | 18 | ||||
-rw-r--r-- | openbsd-compat/strlcpy.c | 18 | ||||
-rw-r--r-- | openbsd-compat/strmode.c | 6 | ||||
-rw-r--r-- | openbsd-compat/strmode.h | 4 | ||||
-rw-r--r-- | openbsd-compat/strsep.c | 10 |
13 files changed, 90 insertions, 117 deletions
diff --git a/openbsd-compat/basename.c b/openbsd-compat/basename.c index 5a3823bc5..2054c8068 100644 --- a/openbsd-compat/basename.c +++ b/openbsd-compat/basename.c | |||
@@ -1,37 +1,26 @@ | |||
1 | /* $OpenBSD: basename.c,v 1.8 2002/06/09 05:03:59 deraadt Exp $ */ | 1 | /* $OpenBSD: basename.c,v 1.11 2003/06/17 21:56:23 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Redistribution and use in source and binary forms, with or without | 6 | * Permission to use, copy, modify, and distribute this software for any |
8 | * modification, are permitted provided that the following conditions | 7 | * purpose with or without fee is hereby granted, provided that the above |
9 | * are met: | 8 | * copyright notice and this permission notice appear in all copies. |
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | 9 | * |
18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | 17 | */ |
29 | #include "includes.h" | ||
30 | 18 | ||
31 | #if !defined(HAVE_BASENAME) | 19 | #include "includes.h" |
20 | #ifndef HAVE_BASENAME | ||
32 | 21 | ||
33 | #ifndef lint | 22 | #ifndef lint |
34 | static char rcsid[] = "$OpenBSD: basename.c,v 1.8 2002/06/09 05:03:59 deraadt Exp $"; | 23 | static char rcsid[] = "$OpenBSD: basename.c,v 1.11 2003/06/17 21:56:23 millert Exp $"; |
35 | #endif /* not lint */ | 24 | #endif /* not lint */ |
36 | 25 | ||
37 | char * | 26 | char * |
diff --git a/openbsd-compat/daemon.c b/openbsd-compat/daemon.c index 06625127c..6dd45f6a7 100644 --- a/openbsd-compat/daemon.c +++ b/openbsd-compat/daemon.c | |||
@@ -32,12 +32,11 @@ | |||
32 | #ifndef HAVE_DAEMON | 32 | #ifndef HAVE_DAEMON |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | static char rcsid[] = "$OpenBSD: daemon.c,v 1.3 2003/06/02 20:18:34 millert Exp $"; | 35 | static char rcsid[] = "$OpenBSD: daemon.c,v 1.5 2003/07/15 17:32:41 deraadt Exp $"; |
36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
37 | 37 | ||
38 | int | 38 | int |
39 | daemon(nochdir, noclose) | 39 | daemon(int nochdir, int noclose) |
40 | int nochdir, noclose; | ||
41 | { | 40 | { |
42 | int fd; | 41 | int fd; |
43 | 42 | ||
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c index 35c7d8ec7..1ab7516d8 100644 --- a/openbsd-compat/dirname.c +++ b/openbsd-compat/dirname.c | |||
@@ -1,46 +1,34 @@ | |||
1 | /* $OpenBSD: dirname.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $ */ | 1 | /* $OpenBSD: dirname.c,v 1.10 2003/06/17 21:56:23 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Redistribution and use in source and binary forms, with or without | 6 | * Permission to use, copy, modify, and distribute this software for any |
8 | * modification, are permitted provided that the following conditions | 7 | * purpose with or without fee is hereby granted, provided that the above |
9 | * are met: | 8 | * copyright notice and this permission notice appear in all copies. |
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | 9 | * |
18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | 17 | */ |
29 | 18 | ||
30 | #include "includes.h" | 19 | #include "includes.h" |
31 | #ifndef HAVE_DIRNAME | 20 | #ifndef HAVE_DIRNAME |
32 | 21 | ||
33 | #if defined(LIBC_SCCS) && !defined(lint) | 22 | #ifndef lint |
34 | static char rcsid[] = "$OpenBSD: dirname.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $"; | 23 | static char rcsid[] = "$OpenBSD: dirname.c,v 1.10 2003/06/17 21:56:23 millert Exp $"; |
35 | #endif /* LIBC_SCCS and not lint */ | 24 | #endif /* not lint */ |
36 | 25 | ||
37 | #include <errno.h> | 26 | #include <errno.h> |
38 | #include <string.h> | 27 | #include <string.h> |
39 | #include <sys/param.h> | 28 | #include <sys/param.h> |
40 | 29 | ||
41 | char * | 30 | char * |
42 | dirname(path) | 31 | dirname(const char *path) |
43 | const char *path; | ||
44 | { | 32 | { |
45 | static char bname[MAXPATHLEN]; | 33 | static char bname[MAXPATHLEN]; |
46 | register const char *endp; | 34 | register const char *endp; |
diff --git a/openbsd-compat/getcwd.c b/openbsd-compat/getcwd.c index 778429487..31d1cfe93 100644 --- a/openbsd-compat/getcwd.c +++ b/openbsd-compat/getcwd.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #if !defined(HAVE_GETCWD) | 32 | #if !defined(HAVE_GETCWD) |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | static char rcsid[] = "$OpenBSD: getcwd.c,v 1.8 2003/06/02 20:18:34 millert Exp $"; | 35 | static char rcsid[] = "$OpenBSD: getcwd.c,v 1.9 2003/06/11 21:03:10 deraadt Exp $"; |
36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
37 | 37 | ||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> |
@@ -50,7 +50,7 @@ static char rcsid[] = "$OpenBSD: getcwd.c,v 1.8 2003/06/02 20:18:34 millert Exp | |||
50 | (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) | 50 | (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) |
51 | 51 | ||
52 | char * | 52 | char * |
53 | getcwd(char *pt,size_t size) | 53 | getcwd(char *pt, size_t size) |
54 | { | 54 | { |
55 | register struct dirent *dp; | 55 | register struct dirent *dp; |
56 | register DIR *dir = NULL; | 56 | register DIR *dir = NULL; |
diff --git a/openbsd-compat/getgrouplist.c b/openbsd-compat/getgrouplist.c index cc622d82c..085cda8c3 100644 --- a/openbsd-compat/getgrouplist.c +++ b/openbsd-compat/getgrouplist.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #ifndef HAVE_GETGROUPLIST | 32 | #ifndef HAVE_GETGROUPLIST |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | static char rcsid[] = "$OpenBSD: getgrouplist.c,v 1.8 2003/06/02 20:18:34 millert Exp $"; | 35 | static char rcsid[] = "$OpenBSD: getgrouplist.c,v 1.9 2003/06/25 21:16:47 deraadt Exp $"; |
36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
37 | 37 | ||
38 | /* | 38 | /* |
@@ -40,6 +40,7 @@ static char rcsid[] = "$OpenBSD: getgrouplist.c,v 1.8 2003/06/02 20:18:34 miller | |||
40 | */ | 40 | */ |
41 | #include <sys/types.h> | 41 | #include <sys/types.h> |
42 | #include <string.h> | 42 | #include <string.h> |
43 | #include <unistd.h> | ||
43 | #include <grp.h> | 44 | #include <grp.h> |
44 | 45 | ||
45 | int | 46 | int |
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c index 2ba56e003..50f35c304 100644 --- a/openbsd-compat/glob.c +++ b/openbsd-compat/glob.c | |||
@@ -52,7 +52,7 @@ get_arg_max(void) | |||
52 | #if 0 | 52 | #if 0 |
53 | static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; | 53 | static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; |
54 | #else | 54 | #else |
55 | static char rcsid[] = "$OpenBSD: glob.c,v 1.21 2003/06/02 20:18:34 millert Exp $"; | 55 | static char rcsid[] = "$OpenBSD: glob.c,v 1.22 2003/06/25 21:16:47 deraadt Exp $"; |
56 | #endif | 56 | #endif |
57 | #endif /* LIBC_SCCS and not lint */ | 57 | #endif /* LIBC_SCCS and not lint */ |
58 | 58 | ||
@@ -611,7 +611,7 @@ glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last, | |||
611 | * and dirent.h as taking pointers to differently typed opaque | 611 | * and dirent.h as taking pointers to differently typed opaque |
612 | * structures. | 612 | * structures. |
613 | */ | 613 | */ |
614 | struct dirent *(*readdirfunc)(); | 614 | struct dirent *(*readdirfunc)(void *); |
615 | 615 | ||
616 | if (pathend > pathend_last) | 616 | if (pathend > pathend_last) |
617 | return (1); | 617 | return (1); |
@@ -636,7 +636,7 @@ glob3(pathbuf, pathbuf_last, pathend, pathend_last, pattern, pattern_last, | |||
636 | if (pglob->gl_flags & GLOB_ALTDIRFUNC) | 636 | if (pglob->gl_flags & GLOB_ALTDIRFUNC) |
637 | readdirfunc = pglob->gl_readdir; | 637 | readdirfunc = pglob->gl_readdir; |
638 | else | 638 | else |
639 | readdirfunc = readdir; | 639 | readdirfunc = (struct dirent *(*)(void *))readdir; |
640 | while ((dp = (*readdirfunc)(dirp))) { | 640 | while ((dp = (*readdirfunc)(dirp))) { |
641 | register u_char *sc; | 641 | register u_char *sc; |
642 | register Char *dc; | 642 | register Char *dc; |
diff --git a/openbsd-compat/readpassphrase.c b/openbsd-compat/readpassphrase.c index 4e549b62b..0d0baf569 100644 --- a/openbsd-compat/readpassphrase.c +++ b/openbsd-compat/readpassphrase.c | |||
@@ -1,34 +1,27 @@ | |||
1 | /* $OpenBSD: readpassphrase.c,v 1.14 2002/06/28 01:43:58 millert Exp $ */ | 1 | /* $OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000-2002 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 2000-2002 Todd C. Miller <Todd.Miller@courtesan.com> |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Redistribution and use in source and binary forms, with or without | 6 | * Permission to use, copy, modify, and distribute this software for any |
8 | * modification, are permitted provided that the following conditions | 7 | * purpose with or without fee is hereby granted, provided that the above |
9 | * are met: | 8 | * copyright notice and this permission notice appear in all copies. |
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | 9 | * |
18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 17 | * |
26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 18 | * Sponsored in part by the Defense Advanced Research Projects |
27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 19 | * Agency (DARPA) and Air Force Research Laboratory, Air Force |
20 | * Materiel Command, USAF, under agreement number F39502-99-1-0512. | ||
28 | */ | 21 | */ |
29 | 22 | ||
30 | #if defined(LIBC_SCCS) && !defined(lint) | 23 | #if defined(LIBC_SCCS) && !defined(lint) |
31 | static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.14 2002/06/28 01:43:58 millert Exp $"; | 24 | static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $"; |
32 | #endif /* LIBC_SCCS and not lint */ | 25 | #endif /* LIBC_SCCS and not lint */ |
33 | 26 | ||
34 | #include "includes.h" | 27 | #include "includes.h" |
@@ -185,6 +178,7 @@ getpass(const char *prompt) | |||
185 | 178 | ||
186 | static void handler(int s) | 179 | static void handler(int s) |
187 | { | 180 | { |
181 | |||
188 | signo = s; | 182 | signo = s; |
189 | } | 183 | } |
190 | #endif /* HAVE_READPASSPHRASE */ | 184 | #endif /* HAVE_READPASSPHRASE */ |
diff --git a/openbsd-compat/realpath.c b/openbsd-compat/realpath.c index 4286bde72..77da14e7c 100644 --- a/openbsd-compat/realpath.c +++ b/openbsd-compat/realpath.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) | 35 | #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) |
36 | 36 | ||
37 | #if defined(LIBC_SCCS) && !defined(lint) | 37 | #if defined(LIBC_SCCS) && !defined(lint) |
38 | static char *rcsid = "$OpenBSD: realpath.c,v 1.9 2003/06/02 20:18:38 millert Exp $"; | 38 | static char *rcsid = "$OpenBSD: realpath.c,v 1.10 2003/08/01 21:04:59 millert Exp $"; |
39 | #endif /* LIBC_SCCS and not lint */ | 39 | #endif /* LIBC_SCCS and not lint */ |
40 | 40 | ||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> |
@@ -65,7 +65,7 @@ char * | |||
65 | realpath(const char *path, char *resolved) | 65 | realpath(const char *path, char *resolved) |
66 | { | 66 | { |
67 | struct stat sb; | 67 | struct stat sb; |
68 | int fd, n, rootd, serrno = 0; | 68 | int fd, n, needslash, serrno = 0; |
69 | char *p, *q, wbuf[MAXPATHLEN], start[MAXPATHLEN]; | 69 | char *p, *q, wbuf[MAXPATHLEN], start[MAXPATHLEN]; |
70 | int symlinks = 0; | 70 | int symlinks = 0; |
71 | 71 | ||
@@ -141,16 +141,16 @@ loop: | |||
141 | * happens if the last component is empty, or the dirname is root. | 141 | * happens if the last component is empty, or the dirname is root. |
142 | */ | 142 | */ |
143 | if (resolved[0] == '/' && resolved[1] == '\0') | 143 | if (resolved[0] == '/' && resolved[1] == '\0') |
144 | rootd = 1; | 144 | needslash = 0; |
145 | else | 145 | else |
146 | rootd = 0; | 146 | needslash = 1; |
147 | 147 | ||
148 | if (*wbuf) { | 148 | if (*wbuf) { |
149 | if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) { | 149 | if (strlen(resolved) + strlen(wbuf) + needslash >= MAXPATHLEN) { |
150 | serrno = ENAMETOOLONG; | 150 | serrno = ENAMETOOLONG; |
151 | goto err1; | 151 | goto err1; |
152 | } | 152 | } |
153 | if (rootd == 0) | 153 | if (needslash == 0) |
154 | strlcat(resolved, "/", MAXPATHLEN); | 154 | strlcat(resolved, "/", MAXPATHLEN); |
155 | strlcat(resolved, wbuf, MAXPATHLEN); | 155 | strlcat(resolved, wbuf, MAXPATHLEN); |
156 | } | 156 | } |
diff --git a/openbsd-compat/strlcat.c b/openbsd-compat/strlcat.c index 8df757730..da1a9fb41 100644 --- a/openbsd-compat/strlcat.c +++ b/openbsd-compat/strlcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */ | 1 | /* $OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -7,20 +7,20 @@ | |||
7 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above |
8 | * copyright notice and this permission notice appear in all copies. | 8 | * copyright notice and this permission notice appear in all copies. |
9 | * | 9 | * |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | #ifndef HAVE_STRLCAT | 20 | #ifndef HAVE_STRLCAT |
21 | 21 | ||
22 | #if defined(LIBC_SCCS) && !defined(lint) | 22 | #if defined(LIBC_SCCS) && !defined(lint) |
23 | static char *rcsid = "$OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $"; | 23 | static char *rcsid = "$OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $"; |
24 | #endif /* LIBC_SCCS and not lint */ | 24 | #endif /* LIBC_SCCS and not lint */ |
25 | 25 | ||
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
diff --git a/openbsd-compat/strlcpy.c b/openbsd-compat/strlcpy.c index fbb4f8ae2..47adc42c5 100644 --- a/openbsd-compat/strlcpy.c +++ b/openbsd-compat/strlcpy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */ | 1 | /* $OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -7,20 +7,20 @@ | |||
7 | * purpose with or without fee is hereby granted, provided that the above | 7 | * purpose with or without fee is hereby granted, provided that the above |
8 | * copyright notice and this permission notice appear in all copies. | 8 | * copyright notice and this permission notice appear in all copies. |
9 | * | 9 | * |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | #ifndef HAVE_STRLCPY | 20 | #ifndef HAVE_STRLCPY |
21 | 21 | ||
22 | #if defined(LIBC_SCCS) && !defined(lint) | 22 | #if defined(LIBC_SCCS) && !defined(lint) |
23 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $"; | 23 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $"; |
24 | #endif /* LIBC_SCCS and not lint */ | 24 | #endif /* LIBC_SCCS and not lint */ |
25 | 25 | ||
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
diff --git a/openbsd-compat/strmode.c b/openbsd-compat/strmode.c index f01352328..adf5e273e 100644 --- a/openbsd-compat/strmode.c +++ b/openbsd-compat/strmode.c | |||
@@ -31,15 +31,17 @@ | |||
31 | #ifndef HAVE_STRMODE | 31 | #ifndef HAVE_STRMODE |
32 | 32 | ||
33 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
34 | static char *rcsid = "$OpenBSD: strmode.c,v 1.4 2003/06/02 20:18:38 millert Exp $"; | 34 | static char *rcsid = "$OpenBSD: strmode.c,v 1.5 2003/06/11 21:08:16 deraadt Exp $"; |
35 | #endif /* LIBC_SCCS and not lint */ | 35 | #endif /* LIBC_SCCS and not lint */ |
36 | 36 | ||
37 | #include <sys/types.h> | 37 | #include <sys/types.h> |
38 | #include <sys/stat.h> | 38 | #include <sys/stat.h> |
39 | #include <string.h> | 39 | #include <string.h> |
40 | 40 | ||
41 | /* XXX mode should be mode_t */ | ||
42 | |||
41 | void | 43 | void |
42 | strmode(register mode_t mode, register char *p) | 44 | strmode(int mode, char *p) |
43 | { | 45 | { |
44 | /* print type */ | 46 | /* print type */ |
45 | switch (mode & S_IFMT) { | 47 | switch (mode & S_IFMT) { |
diff --git a/openbsd-compat/strmode.h b/openbsd-compat/strmode.h index 64f7c8aae..236ecf2f4 100644 --- a/openbsd-compat/strmode.h +++ b/openbsd-compat/strmode.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* $Id: strmode.h,v 1.3 2001/06/09 02:22:17 mouring Exp $ */ | 1 | /* $Id: strmode.h,v 1.4 2003/08/25 01:10:52 mouring Exp $ */ |
2 | 2 | ||
3 | #ifndef HAVE_STRMODE | 3 | #ifndef HAVE_STRMODE |
4 | 4 | ||
5 | void strmode(register mode_t mode, register char *p); | 5 | void strmode(int mode, char *p); |
6 | 6 | ||
7 | #endif | 7 | #endif |
diff --git a/openbsd-compat/strsep.c b/openbsd-compat/strsep.c index d7fcc60a0..b13671343 100644 --- a/openbsd-compat/strsep.c +++ b/openbsd-compat/strsep.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strsep.c,v 1.4 2003/06/02 20:18:38 millert Exp $ */ | 1 | /* $OpenBSD: strsep.c,v 1.5 2003/06/11 21:08:16 deraadt Exp $ */ |
2 | 2 | ||
3 | /*- | 3 | /*- |
4 | * Copyright (c) 1990, 1993 | 4 | * Copyright (c) 1990, 1993 |
@@ -40,7 +40,7 @@ | |||
40 | #if 0 | 40 | #if 0 |
41 | static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; | 41 | static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; |
42 | #else | 42 | #else |
43 | static char *rcsid = "$OpenBSD: strsep.c,v 1.4 2003/06/02 20:18:38 millert Exp $"; | 43 | static char *rcsid = "$OpenBSD: strsep.c,v 1.5 2003/06/11 21:08:16 deraadt Exp $"; |
44 | #endif | 44 | #endif |
45 | #endif /* LIBC_SCCS and not lint */ | 45 | #endif /* LIBC_SCCS and not lint */ |
46 | 46 | ||
@@ -58,9 +58,9 @@ static char *rcsid = "$OpenBSD: strsep.c,v 1.4 2003/06/02 20:18:38 millert Exp $ | |||
58 | char * | 58 | char * |
59 | strsep(char **stringp, const char *delim) | 59 | strsep(char **stringp, const char *delim) |
60 | { | 60 | { |
61 | register char *s; | 61 | char *s; |
62 | register const char *spanp; | 62 | const char *spanp; |
63 | register int c, sc; | 63 | int c, sc; |
64 | char *tok; | 64 | char *tok; |
65 | 65 | ||
66 | if ((s = *stringp) == NULL) | 66 | if ((s = *stringp) == NULL) |