summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2014-11-06 07:43:40 +0000
committerBryan Cantrill <bryan@joyent.com>2014-11-06 07:43:40 +0000
commit474a11108331eb3cfffdfd61d02a64fcc861f791 (patch)
tree62cb6af6ab10789dbda3282043a6096a736a2433 /usr/src
parent75d48a96e080e8ed2bdf6e2ca5379055546992b7 (diff)
downloadillumos-joyent-474a11108331eb3cfffdfd61d02a64fcc861f791.tar.gz
OS-3528 LX_DEBUG no longer works as of OS-3447
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/debug.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/debug.c b/usr/src/lib/brand/lx/lx_brand/common/debug.c
index 72472510ef..77131c70d3 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/debug.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/debug.c
@@ -93,6 +93,7 @@ lx_debug(const char *msg, ...)
char *buf;
int rv, fd, n;
int errno_backup;
+ int size = LX_MSG_MAXLEN + 1;
if (lx_debug_enabled == 0)
return;
@@ -102,21 +103,20 @@ lx_debug(const char *msg, ...)
* footprint. The buffer allocation is thus done conditionally,
* rather than as regular automatic storage.
*/
- if ((buf = SAFE_ALLOCA(LX_MSG_MAXLEN + 1)) == NULL)
+ if ((buf = SAFE_ALLOCA(size)) == NULL)
return;
errno_backup = errno;
/* prefix the message with pid/tid */
- if ((n = snprintf(buf, sizeof (buf), "%u/%u: ",
- getpid(), thr_self())) == -1) {
+ if ((n = snprintf(buf, size, "%u/%u: ", getpid(), thr_self())) == -1) {
errno = errno_backup;
return;
}
/* format the message */
va_start(ap, msg);
- rv = vsnprintf(&buf[n], sizeof (buf) - n, msg, ap);
+ rv = vsnprintf(&buf[n], size - n, msg, ap);
va_end(ap);
if (rv == -1) {
errno = errno_backup;
@@ -125,7 +125,7 @@ lx_debug(const char *msg, ...)
/* add a carrige return if there isn't one already */
if ((buf[strlen(buf) - 1] != '\n') &&
- (strlcat(buf, "\n", sizeof (buf)) >= sizeof (buf))) {
+ (strlcat(buf, "\n", size) >= size)) {
errno = errno_backup;
return;
}