summaryrefslogtreecommitdiff
path: root/lib/unistr/u-stpncpy.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-01-10 21:39:12 +0100
committerBruno Haible <bruno@clisp.org>2010-01-10 21:39:12 +0100
commitb37182eb01e20e28b78bc65033b01a51c658e2fc (patch)
treef9a08614798df0fb225a7b5b3a3dd3d039b7eefc /lib/unistr/u-stpncpy.h
parentfe36c7a0984ab97b84f3909cd1d2be5e91706515 (diff)
downloadgnulib-b37182eb01e20e28b78bc65033b01a51c658e2fc.tar.gz
unistr/u*-stpncpy: Fix the return value.
Diffstat (limited to 'lib/unistr/u-stpncpy.h')
-rw-r--r--lib/unistr/u-stpncpy.h10
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;
}