summaryrefslogtreecommitdiff
path: root/common/compat.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-03-02 01:25:00 +0000
committerStef Walter <stef@memberwebs.com>2008-03-02 01:25:00 +0000
commit9a78f86f773cbf34e29ec51fc06e3f04072c88d0 (patch)
tree00054e6e536769a35b4215567755494486cc36ec /common/compat.c
parentec1a79b0f75cfd34085e046ecb30382a402ea318 (diff)
- Support failover between multiple agents
- Support table queries - Major refactoring of internals.
Diffstat (limited to 'common/compat.c')
-rw-r--r--common/compat.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/common/compat.c b/common/compat.c
index 6f9c58d..53de9bf 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -136,15 +136,18 @@ strtob(const char* str)
size_t
strlcpy(char *dst, const char *src, size_t len)
{
- size_t ret = strlen(dst);
+ size_t ret = strlen(src);
+ size_t copied;
- while (len > 1) {
+ while (ret > 0 && len > 1) {
*dst++ = *src++;
- len--;
+ --len;
+ --ret;
+ ++copied;
}
if (len > 0)
*dst = '\0';
- return (ret);
+ return copied;
}
#endif /* HAVE_STRLCPY */