summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2003-07-31 05:18:18 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-31 05:18:18 -0700
commit5617bd56041a623f660f759e5bc69359bbfdb94c (patch)
tree014f7f6debedb9be0217f38614456c38c581b840 /lib
parentc67574a357dbbaf1cbc9a003197a6a992bad669b (diff)
[PATCH] fix strncpy on generic user platforms
Diffstat (limited to 'lib')
-rw-r--r--lib/string.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c
index 112389ed554a..b7df79574a57 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -80,8 +80,7 @@ char * strcpy(char * dest,const char *src)
* @src: Where to copy the string from
* @count: The maximum number of bytes to copy
*
- * Note that unlike userspace strncpy, this does not %NUL-pad the buffer.
- * However, the result is not %NUL-terminated if the source exceeds
+ * The result is not %NUL-terminated if the source exceeds
* @count bytes.
*/
char * strncpy(char * dest,const char *src,size_t count)
@@ -90,7 +89,8 @@ char * strncpy(char * dest,const char *src,size_t count)
while (count-- && (*dest++ = *src++) != '\0')
/* nothing */;
-
+ while (count-- > 0)
+ *dest++ = 0;
return tmp;
}
#endif