diff options
author | Bruno Haible <bruno@clisp.org> | 2010-01-10 21:39:12 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2010-01-10 21:39:12 +0100 |
commit | b37182eb01e20e28b78bc65033b01a51c658e2fc (patch) | |
tree | f9a08614798df0fb225a7b5b3a3dd3d039b7eefc /lib/unistr | |
parent | fe36c7a0984ab97b84f3909cd1d2be5e91706515 (diff) | |
download | gnulib-b37182eb01e20e28b78bc65033b01a51c658e2fc.tar.gz |
unistr/u*-stpncpy: Fix the return value.
Diffstat (limited to 'lib/unistr')
-rw-r--r-- | lib/unistr/u-stpncpy.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/unistr/u-stpncpy.h b/lib/unistr/u-stpncpy.h index 335a8519d8..4d6dd3c701 100644 --- a/lib/unistr/u-stpncpy.h +++ b/lib/unistr/u-stpncpy.h @@ -23,8 +23,12 @@ FUNC (UNIT *dest, const UNIT *src, size_t n) /* This behavior is rarely useful, but it is here for consistency with strncpy and wcsncpy. */ - for (; n > 0; n--) - *dest++ = 0; + { + UNIT *destptr = dest; - return dest - 1; + for (; n > 0; n--) + *destptr++ = 0; + } + + return dest; } |