Browse Source

fix badly broken code. okay millert@, deraadt@

OPENBSD_4_0
espie 18 years ago
parent
commit
14b69ad0fc
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/lib/libc/string/wcsncpy.c

+ 7
- 7
src/lib/libc/string/wcsncpy.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: wcsncpy.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */
/* $OpenBSD: wcsncpy.c,v 1.4 2006/04/17 18:05:35 espie Exp $ */
/* $NetBSD: wcsncpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ /* $NetBSD: wcsncpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */
/*- /*-
@ -35,16 +35,16 @@ wchar_t *
wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n) wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n)
{ {
wchar_t *p; wchar_t *p;
const wchar_t *q;
*s1 = '\0';
p = s1; p = s1;
q = s2;
while (n && *q) {
*p++ = *q++;
while (n && *s2) {
*p++ = *s2++;
n--;
}
while (n) {
*p++ = L'\0';
n--; n--;
} }
*p = '\0';
return s1; return s1;
} }

Loading…
Cancel
Save