diff --git a/sbin/hastd/subr.c b/sbin/hastd/subr.c index 24d6dd51441d..213dcd27b869 100644 --- a/sbin/hastd/subr.c +++ b/sbin/hastd/subr.c @@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include @@ -45,6 +48,27 @@ __FBSDID("$FreeBSD$"); #include "hast.h" #include "subr.h" +int +vsnprlcat(char *str, size_t size, const char *fmt, va_list ap) +{ + size_t len; + + len = strlen(str); + return (vsnprintf(str + len, size - len, fmt, ap)); +} + +int +snprlcat(char *str, size_t size, const char *fmt, ...) +{ + va_list ap; + int result; + + va_start(ap, fmt); + result = vsnprlcat(str, size, fmt, ap); + va_end(ap); + return (result); +} + int provinfo(struct hast_resource *res, bool dowrite) { diff --git a/sbin/hastd/subr.h b/sbin/hastd/subr.h index 913d2a424c3c..0b9b55557af1 100644 --- a/sbin/hastd/subr.h +++ b/sbin/hastd/subr.h @@ -45,6 +45,9 @@ errno = _rerrno; \ } while (0) +int vsnprlcat(char *str, size_t size, const char *fmt, va_list ap); +int snprlcat(char *str, size_t size, const char *fmt, ...); + int provinfo(struct hast_resource *res, bool dowrite); const char *role2str(int role); int drop_privs(void);