summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/string/strxfrm.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/lib/libc/string/strxfrm.c b/src/lib/libc/string/strxfrm.c
index b7c8d4822d..a2e2dbc440 100644
--- a/src/lib/libc/string/strxfrm.c
+++ b/src/lib/libc/string/strxfrm.c
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: strxfrm.c,v 1.4 2003/06/11 21:08:16 deraadt Exp $"; 34static char *rcsid = "$OpenBSD: strxfrm.c,v 1.5 2003/09/06 22:43:12 tedu Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <string.h> 37#include <string.h>
@@ -44,23 +44,11 @@ static char *rcsid = "$OpenBSD: strxfrm.c,v 1.4 2003/06/11 21:08:16 deraadt Exp
44size_t 44size_t
45strxfrm(char *dst, const char *src, size_t n) 45strxfrm(char *dst, const char *src, size_t n)
46{ 46{
47 size_t r = 0;
48 int c;
49 47
50 /* 48 /*
51 * Since locales are unimplemented, this is just a copy. 49 * Since locales are unimplemented, this is just a copy.
52 */ 50 */
53 if (n != 0) { 51 if (n == 0)
54 while ((c = *src++) != 0) { 52 return (strlen(src));
55 r++; 53 return (strlcpy(dst, src, n));
56 if (--n == 0) {
57 while (*src++ != 0)
58 r++;
59 break;
60 }
61 *dst++ = c;
62 }
63 *dst = 0;
64 }
65 return (r);
66} 54}