This commit is contained in:
Cloud Wu
2015-11-11 15:06:10 +08:00
parent 7521fe0530
commit 9f3baf2ee3

View File

@@ -28,7 +28,7 @@ skynet_error(struct skynet_context * context, const char *msg, ...) {
va_start(ap,msg);
int len = vsnprintf(tmp, LOG_MESSAGE_SIZE, msg, ap);
va_end(ap);
if (len < LOG_MESSAGE_SIZE) {
if (len >=0 && len < LOG_MESSAGE_SIZE) {
data = skynet_strdup(tmp);
} else {
int max_size = LOG_MESSAGE_SIZE;
@@ -44,6 +44,11 @@ skynet_error(struct skynet_context * context, const char *msg, ...) {
skynet_free(data);
}
}
if (len < 0) {
skynet_free(data);
perror("vsnprintf error :");
return;
}
struct skynet_message smsg;