On 20/03/08 17:26 +0100, Uwe Hermann wrote:
On Thu, Mar 20, 2008 at 08:51:39AM -0600, Jordan Crouse wrote:
+char *strcpy(char *d, const char *s) +{
- return strncpy(d, s, strlen(s));
+}
This doesn't put a terminating 0 on the string.
Oops - he's right. Uwe, can you do a quick fix?
How about this? Untested, but should work.
Yeah, that seems good to me.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com
Uwe.
http://www.hermann-uwe.de | http://www.holsham-traders.de http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
Fix strcpy() implementation.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de
Index: libc/string.c
--- libc/string.c (Revision 3179) +++ libc/string.c (Arbeitskopie) @@ -143,7 +143,10 @@
char *strcpy(char *d, const char *s) {
- return strncpy(d, s, strlen(s));
- char *orig = d;
- while ((*(d++) = *(s++)));
- return orig;
}
char *strncat(char *d, const char *s, int n)