Add printf attribute and fix warnings and a minor bug (#7803)
The fix in error handling of rdbGenericLoadStringObject is an actual bugfix
This commit is contained in:
parent
f866023399
commit
092cfca522
11
src/rdb.c
11
src/rdb.c
@ -52,6 +52,9 @@ extern int rdbCheckMode;
|
|||||||
void rdbCheckError(const char *fmt, ...);
|
void rdbCheckError(const char *fmt, ...);
|
||||||
void rdbCheckSetError(const char *fmt, ...);
|
void rdbCheckSetError(const char *fmt, ...);
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
void rdbReportError(int corruption_error, int linenum, char *reason, ...) __attribute__ ((format (printf, 3, 4)));
|
||||||
|
#endif
|
||||||
void rdbReportError(int corruption_error, int linenum, char *reason, ...) {
|
void rdbReportError(int corruption_error, int linenum, char *reason, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
@ -487,7 +490,7 @@ void *rdbGenericLoadStringObject(rio *rdb, int flags, size_t *lenptr) {
|
|||||||
int plain = flags & RDB_LOAD_PLAIN;
|
int plain = flags & RDB_LOAD_PLAIN;
|
||||||
int sds = flags & RDB_LOAD_SDS;
|
int sds = flags & RDB_LOAD_SDS;
|
||||||
int isencoded;
|
int isencoded;
|
||||||
uint64_t len;
|
unsigned long long len;
|
||||||
|
|
||||||
len = rdbLoadLen(rdb,&isencoded);
|
len = rdbLoadLen(rdb,&isencoded);
|
||||||
if (isencoded) {
|
if (isencoded) {
|
||||||
@ -499,8 +502,8 @@ void *rdbGenericLoadStringObject(rio *rdb, int flags, size_t *lenptr) {
|
|||||||
case RDB_ENC_LZF:
|
case RDB_ENC_LZF:
|
||||||
return rdbLoadLzfStringObject(rdb,flags,lenptr);
|
return rdbLoadLzfStringObject(rdb,flags,lenptr);
|
||||||
default:
|
default:
|
||||||
rdbExitReportCorruptRDB("Unknown RDB string encoding type %d",len);
|
rdbExitReportCorruptRDB("Unknown RDB string encoding type %llu",len);
|
||||||
return NULL; /* Never reached. */
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2198,7 +2201,7 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
|||||||
if (luaCreateFunction(NULL,server.lua,auxval) == NULL) {
|
if (luaCreateFunction(NULL,server.lua,auxval) == NULL) {
|
||||||
rdbExitReportCorruptRDB(
|
rdbExitReportCorruptRDB(
|
||||||
"Can't load Lua script from RDB file! "
|
"Can't load Lua script from RDB file! "
|
||||||
"BODY: %s", auxval->ptr);
|
"BODY: %s", (char*)auxval->ptr);
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(auxkey->ptr,"redis-ver")) {
|
} else if (!strcasecmp(auxkey->ptr,"redis-ver")) {
|
||||||
serverLog(LL_NOTICE,"Loading RDB produced by version %s",
|
serverLog(LL_NOTICE,"Loading RDB produced by version %s",
|
||||||
|
@ -2464,7 +2464,12 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated));
|
|||||||
/* Debugging stuff */
|
/* Debugging stuff */
|
||||||
void _serverAssertWithInfo(const client *c, const robj *o, const char *estr, const char *file, int line);
|
void _serverAssertWithInfo(const client *c, const robj *o, const char *estr, const char *file, int line);
|
||||||
void _serverAssert(const char *estr, const char *file, int line);
|
void _serverAssert(const char *estr, const char *file, int line);
|
||||||
|
#ifdef __GNUC__
|
||||||
|
void _serverPanic(const char *file, int line, const char *msg, ...)
|
||||||
|
__attribute__ ((format (printf, 3, 4)));
|
||||||
|
#else
|
||||||
void _serverPanic(const char *file, int line, const char *msg, ...);
|
void _serverPanic(const char *file, int line, const char *msg, ...);
|
||||||
|
#endif
|
||||||
void serverLogObjectDebugInfo(const robj *o);
|
void serverLogObjectDebugInfo(const robj *o);
|
||||||
void sigsegvHandler(int sig, siginfo_t *info, void *secret);
|
void sigsegvHandler(int sig, siginfo_t *info, void *secret);
|
||||||
sds genRedisInfoString(const char *section);
|
sds genRedisInfoString(const char *section);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user