From e57a5fcc212c0d5db0a466dd27cd3cbc541cba85 Mon Sep 17 00:00:00 2001 From: maartenbrock Date: Fri, 27 May 2005 07:33:47 +0000 Subject: [PATCH] * device/lib/_strncpy.c: fixed the fix git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3775 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 6 +++++- device/lib/_strncpy.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea242ced..5b59a009 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-05-27 Maarten Brock + + * device/lib/_strncpy.c: fixed the fix + 2005-05-26 Raphael Neider * src/pic16/glue.c (pic16_printIvalChar): fixed _constant_ string @@ -12,7 +16,7 @@ * src/pic16/main.c (_process_pragma): added sanity checks for stack position and size, emit warnings when appropriate -2005-05-21 Maarten Brock +2005-05-26 Maarten Brock * device/lib/_strncpy.c: fixed not filling with \0 diff --git a/device/lib/_strncpy.c b/device/lib/_strncpy.c index 2b7aa481..505379eb 100644 --- a/device/lib/_strncpy.c +++ b/device/lib/_strncpy.c @@ -30,9 +30,14 @@ char *strncpy ( { register char * d1 = d; - while ( n-- && *s ) + while ( n && *s ) + { + n-- ; *d++ = *s++ ; + } while ( n-- ) + { *d++ = '\0' ; + } return d1; } -- 2.30.2