projects
/
libusual.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
36151fd
)
logging: fix signed vs. unsigned cmp warning
author
Marko Kreen
<markokr@gmail.com>
Mon, 12 Apr 2010 09:14:49 +0000
(12:14 +0300)
committer
Marko Kreen
<markokr@gmail.com>
Mon, 12 Apr 2010 09:16:48 +0000
(12:16 +0300)
usual/logging.c
patch
|
blob
|
blame
|
history
diff --git
a/usual/logging.c
b/usual/logging.c
index 223753174a2c5db880df3cc8ad42482812e0815a..36e34e48433cddb3dc40ceb19bcde46f5dbd8afe 100644
(file)
--- a/
usual/logging.c
+++ b/
usual/logging.c
@@
-106,6
+106,8
@@
void log_generic(enum LogLevel level, void *ctx, const char *fmt, ...)
pfxlen = logging_prefix_cb(level, ctx, buf, sizeof(buf));
if (pfxlen < 0)
return;
+ if (pfxlen >= (int)sizeof(buf))
+ pfxlen = sizeof(buf) - 1;
}
va_start(ap, fmt);
vsnprintf(buf + pfxlen, sizeof(buf) - pfxlen, fmt, ap);