Unverified Commit c77b8f45 authored by cyy-tag's avatar cyy-tag Committed by GitHub
Browse files

Fixed variable parameter formatting issues in serverPanic function (#13504)



Currently aeApiPoll panic does not record error code information. Added
variable parameter formatting to _serverPanic to fix the issue

---------
Co-authored-by: default avataryingyin.chen <15816602944@163.com>
parent a7afd1d2
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
*/ */
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
...@@ -46,8 +47,15 @@ void _serverAssert(const char *estr, const char *file, int line) { ...@@ -46,8 +47,15 @@ void _serverAssert(const char *estr, const char *file, int line) {
} }
void _serverPanic(const char *file, int line, const char *msg, ...) { void _serverPanic(const char *file, int line, const char *msg, ...) {
va_list ap;
char fmtmsg[256];
va_start(ap,msg);
vsnprintf(fmtmsg,sizeof(fmtmsg),msg,ap);
va_end(ap);
fprintf(stderr, "------------------------------------------------"); fprintf(stderr, "------------------------------------------------");
fprintf(stderr, "!!! Software Failure. Press left mouse button to continue"); fprintf(stderr, "!!! Software Failure. Press left mouse button to continue");
fprintf(stderr, "Guru Meditation: %s #%s:%d",msg,file,line); fprintf(stderr, "Guru Meditation: %s #%s:%d",fmtmsg,file,line);
abort(); abort();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment