summaryrefslogtreecommitdiff
path: root/lib/string.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@nuts.ninka.net>2003-08-01 05:17:03 -0700
committerDavid S. Miller <davem@nuts.ninka.net>2003-08-01 05:17:03 -0700
commitb2e268b36f9a9aa997e5455f2a43f89780f78eca (patch)
tree6814f62c0996397644c8c6ca3a7d2fe5eaa4b235 /lib/string.c
parent06f132079d1f6110382a9c3cba692d2b8e39d969 (diff)
[STRING]: Fix bug in generic strncpy() change.
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c
index b7df79574a57..d50185536bf3 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -87,10 +87,12 @@ char * strncpy(char * dest,const char *src,size_t count)
{
char *tmp = dest;
- while (count-- && (*dest++ = *src++) != '\0')
- /* nothing */;
- while (count-- > 0)
+ while (count && (*dest++ = *src++) != '\0')
+ count--;
+ while (count) {
*dest++ = 0;
+ count--;
+ }
return tmp;
}
#endif