diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/lib/str.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/usr.sbin/pkg_install/lib/str.c b/usr.sbin/pkg_install/lib/str.c index f6294699b7c..4a251eca5e4 100644 --- a/usr.sbin/pkg_install/lib/str.c +++ b/usr.sbin/pkg_install/lib/str.c @@ -1,7 +1,7 @@ -/* $OpenBSD: str.c,v 1.9 2003/04/05 16:06:01 avsm Exp $ */ +/* $OpenBSD: str.c,v 1.10 2003/04/05 18:02:32 avsm Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: str.c,v 1.9 2003/04/05 16:06:01 avsm Exp $"; +static const char *rcsid = "$OpenBSD: str.c,v 1.10 2003/04/05 18:02:32 avsm Exp $"; #endif /* @@ -94,9 +94,7 @@ copy_string(char *str) if (!str) ret = NULL; else { - int len = strlen(str) + 1; - ret = (char *)malloc(len); - strlcpy(ret, str, len); + ret = strdup(str); } return ret; } @@ -366,17 +364,3 @@ findbestmatchingname(const char *dir, const char *pattern) } return NULL; } - -/* bounds-checking strncpy */ -char * -strnncpy(char *to, size_t tosize, char *from, size_t cc) -{ - size_t len; - - if ((len = cc) >= tosize - 1) { - len = tosize - 1; - } - (void) strncpy(to, from, len); - to[len] = 0; - return to; -} |