diff options
author | Jon Schlueter <jschlueter@redhat.com> | 2015-10-06 04:29:37 -0400 |
---|---|---|
committer | Jon Schlueter <jschlueter@redhat.com> | 2015-10-06 04:31:59 -0400 |
commit | c9d7ff1be596a0cea5cea35156d8ee6ff44080ac (patch) | |
tree | e101cc4adde017cedea8f57249fe059f48679829 /json.c | |
parent | 5c20d030c70578d6d212b00cc972e2b19d5abf9c (diff) | |
download | gpsd-c9d7ff1be596a0cea5cea35156d8ee6ff44080ac.tar.gz |
json_trace improvement
guard on FILE * not being NULL
initialize the buffer for easier debugging
Diffstat (limited to 'json.c')
-rw-r--r-- | json.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -93,8 +93,8 @@ void json_enable_debug(int level, FILE * fp) static void json_trace(int errlevel, const char *fmt, ...) /* assemble command in printf(3) style */ { - if (errlevel <= debuglevel) { - char buf[BUFSIZ]; + if (errlevel <= debuglevel && NULL != debugfp) { + char buf[BUFSIZ] = {0}; va_list ap; (void)strlcpy(buf, "json: ", sizeof(buf)); |