summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/string.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/string.h b/src/include/string.h
index a000e6cb62..7597323c47 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -69,10 +69,13 @@ static inline char *strconcat(const char *s1, const char *s2)
static inline char *strncpy(char *to, const char *from, int count)
{
register char *ret = to;
+ register char data;
while (count > 0) {
count--;
- if ((*to++ = *from++) == '\0')
+ data = *from++;
+ *to++ = data;
+ if (data == '\0')
break;
}