From 76064352a6b9f168cecc607cc27464fa42d65c24 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 8 Dec 2009 09:36:31 +0100 Subject: [PATCH] Add bstrncat comments --- bacula/src/lib/bsys.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c index 9d1a7ca6b1..ca95240533 100644 --- a/bacula/src/lib/bsys.c +++ b/bacula/src/lib/bsys.c @@ -115,7 +115,6 @@ char *bstrncpy(char *dest, POOL_MEM &src, int maxlen) return dest; } - char *bstrncat(char *dest, const char *src, int maxlen) { int len = strlen(dest); @@ -126,9 +125,13 @@ char *bstrncat(char *dest, const char *src, int maxlen) return dest; } +/* + * Note: Here the maxlen is the maximum length permitted + * stored in dest, while on Unix systems, it is the maximum characters + * that may be copied from src. + */ char *bstrncat(char *dest, POOL_MEM &src, int maxlen) { - int len = strlen(dest); if (len < maxlen-1) { strncpy(dest+len, src.c_str(), maxlen-len-1); -- 2.39.5