Browse Source

ckdb - log errors for calls to _data_to_buf with null data

master
kanoi 8 years ago
parent
commit
6b59f1442a
  1. 2
      src/ckdb.h
  2. 18
      src/ckdb_data.c

2
src/ckdb.h

@ -58,7 +58,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "1.0.7"
#define CKDB_VERSION DB_VERSION"-2.515"
#define CKDB_VERSION DB_VERSION"-2.516"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__

18
src/ckdb_data.c

@ -505,9 +505,27 @@ void _txt_to_double(char *nam, char *fld, double *data, size_t siz, WHERE_FFL_AR
char *_data_to_buf(enum data_type typ, void *data, char *buf, size_t siz, WHERE_FFL_ARGS)
{
static bool had_null = false;
struct tm tm;
double d;
// Return an empty string but only log a console message the first time
if (!data) {
// locking doesn't matter - if we get extra messages
if (!had_null) {
had_null = true;
LOGEMERG("%s() BUG - called with null data - check"
" log file" WHERE_FFL,
__func__, WHERE_FFL_PASS);
}
LOGNOTICE("%s() BUG - called with null data typ=%d" WHERE_FFL,
__func__, (int)typ, WHERE_FFL_PASS);
if (!buf)
buf = malloc(1);
*buf = '\0';
return buf;
}
if (!buf) {
switch (typ) {
case TYPE_STR:

Loading…
Cancel
Save