summaryrefslogtreecommitdiffstats
path: root/sbin/hastd
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-06-03 10:50:46 +0000
committerpjd <pjd@FreeBSD.org>2012-06-03 10:50:46 +0000
commit2143a387af01a0645e5638d5fe47597bb07faca0 (patch)
treebd07466199848f421292ba4b1ad8dc053191711e /sbin/hastd
parent136f4d257be3b917e024b27a0bf5227de19fb08f (diff)
downloadFreeBSD-src-2143a387af01a0645e5638d5fe47597bb07faca0.zip
FreeBSD-src-2143a387af01a0645e5638d5fe47597bb07faca0.tar.gz
Simplify the code by using snprlcat().
MFC after: 3 days
Diffstat (limited to 'sbin/hastd')
-rw-r--r--sbin/hastd/primary.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c
index 81d08eb..d6d93b1 100644
--- a/sbin/hastd/primary.c
+++ b/sbin/hastd/primary.c
@@ -990,36 +990,33 @@ reqlog(int loglevel, int debuglevel, struct g_gate_ctl_io *ggio, const char *fmt
{
char msg[1024];
va_list ap;
- int len;
va_start(ap, fmt);
- len = vsnprintf(msg, sizeof(msg), fmt, ap);
+ (void)vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
- if ((size_t)len < sizeof(msg)) {
- switch (ggio->gctl_cmd) {
- case BIO_READ:
- (void)snprintf(msg + len, sizeof(msg) - len,
- "READ(%ju, %ju).", (uintmax_t)ggio->gctl_offset,
- (uintmax_t)ggio->gctl_length);
- break;
- case BIO_DELETE:
- (void)snprintf(msg + len, sizeof(msg) - len,
- "DELETE(%ju, %ju).", (uintmax_t)ggio->gctl_offset,
- (uintmax_t)ggio->gctl_length);
- break;
- case BIO_FLUSH:
- (void)snprintf(msg + len, sizeof(msg) - len, "FLUSH.");
- break;
- case BIO_WRITE:
- (void)snprintf(msg + len, sizeof(msg) - len,
- "WRITE(%ju, %ju).", (uintmax_t)ggio->gctl_offset,
- (uintmax_t)ggio->gctl_length);
- break;
- default:
- (void)snprintf(msg + len, sizeof(msg) - len,
- "UNKNOWN(%u).", (unsigned int)ggio->gctl_cmd);
- break;
- }
+ switch (ggio->gctl_cmd) {
+ case BIO_READ:
+ (void)snprlcat(msg, sizeof(msg), "READ(%ju, %ju).",
+ (uintmax_t)ggio->gctl_offset,
+ (uintmax_t)ggio->gctl_length);
+ break;
+ case BIO_DELETE:
+ (void)snprlcat(msg, sizeof(msg), "DELETE(%ju, %ju).",
+ (uintmax_t)ggio->gctl_offset,
+ (uintmax_t)ggio->gctl_length);
+ break;
+ case BIO_FLUSH:
+ (void)snprlcat(msg, sizeof(msg), "FLUSH.");
+ break;
+ case BIO_WRITE:
+ (void)snprlcat(msg, sizeof(msg), "WRITE(%ju, %ju).",
+ (uintmax_t)ggio->gctl_offset,
+ (uintmax_t)ggio->gctl_length);
+ break;
+ default:
+ (void)snprlcat(msg, sizeof(msg), "UNKNOWN(%u).",
+ (unsigned int)ggio->gctl_cmd);
+ break;
}
pjdlog_common(loglevel, debuglevel, -1, "%s", msg);
}
OpenPOWER on IntegriCloud