summaryrefslogtreecommitdiffstats
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-06-28 14:48:28 +1000
committerDamien Miller <djm@mindrot.org>2001-06-28 14:48:28 +1000
commit180207ffe1a54bb15d10ce54fdc854b8dcd0511f (patch)
treecb5a7d07cd28ff08c26f163112d33b7ded283ff6 /openbsd-compat
parent315f8b70b0e255fd7c2222794631d233569ce22b (diff)
- (djm) Sync openbsd-compat with -current libc
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/dirname.c7
-rw-r--r--openbsd-compat/realpath.c5
-rw-r--r--openbsd-compat/strlcat.c11
-rw-r--r--openbsd-compat/strlcpy.c7
4 files changed, 15 insertions, 15 deletions
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c
index c2908267..a76a1dc1 100644
--- a/openbsd-compat/dirname.c
+++ b/openbsd-compat/dirname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $ */
+/* $OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
#ifndef HAVE_DIRNAME
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $";
+static char rcsid[] = "$OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $";
#endif /* LIBC_SCCS and not lint */
#include <errno.h>
@@ -74,8 +74,7 @@ dirname(path)
errno = ENAMETOOLONG;
return(NULL);
}
- (void)strncpy(bname, path, endp - path + 1);
- bname[endp - path + 1] = '\0';
+ strlcpy(bname, path, endp - path + 2);
return(bname);
}
#endif
diff --git a/openbsd-compat/realpath.c b/openbsd-compat/realpath.c
index fbe2a9c2..ec801d49 100644
--- a/openbsd-compat/realpath.c
+++ b/openbsd-compat/realpath.c
@@ -32,7 +32,7 @@
#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH)
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: realpath..c,v 1.4 1998/05/18 09:55:19 deraadt Exp $";
+static char *rcsid = "$OpenBSD: realpath.c,v 1.5 2001/06/27 00:58:56 lebel Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -82,8 +82,7 @@ realpath(const char *path, char *resolved)
* if it is a directory, then change to that directory.
* get the current directory name and append the basename.
*/
- (void)strncpy(resolved, path, MAXPATHLEN - 1);
- resolved[MAXPATHLEN - 1] = '\0';
+ strlcpy(resolved, path, MAXPATHLEN);
loop:
q = strrchr(resolved, '/');
if (q != NULL) {
diff --git a/openbsd-compat/strlcat.c b/openbsd-compat/strlcat.c
index d80739fc..6ff65c19 100644
--- a/openbsd-compat/strlcat.c
+++ b/openbsd-compat/strlcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $ */
+/* $OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
#ifndef HAVE_STRLCAT
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $";
+static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -42,10 +42,11 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(initial dst) + strlen(src); if retval >= siz,
- * truncation occurred.
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
*/
-size_t strlcat(dst, src, siz)
+size_t
+strlcat(dst, src, siz)
char *dst;
const char *src;
size_t siz;
diff --git a/openbsd-compat/strlcpy.c b/openbsd-compat/strlcpy.c
index 99b06dd9..b5e5a552 100644
--- a/openbsd-compat/strlcpy.c
+++ b/openbsd-compat/strlcpy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */
+/* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
#ifndef HAVE_STRLCPY
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
+static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -43,7 +43,8 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
-size_t strlcpy(dst, src, siz)
+size_t
+strlcpy(dst, src, siz)
char *dst;
const char *src;
size_t siz;