mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Fix DEBUG_packet_visualise() log output
This commit is contained in:
parent
355af1f874
commit
9ede55ab4c
4
log.c
4
log.c
@ -223,14 +223,14 @@ void logString(int level, const char *file, unsigned int line, const char *funct
|
||||
for (p = str; *p; ++p) {
|
||||
if (*p == '\n') {
|
||||
if (_log_prepare(level, file, line, function)) {
|
||||
strbuf_ncat(&logbuf, str, p - s);
|
||||
strbuf_ncat(&logbuf, s, p - s);
|
||||
_log_finish(level);
|
||||
}
|
||||
s = p + 1;
|
||||
}
|
||||
}
|
||||
if (p > s && _log_prepare(level, file, line, function)) {
|
||||
strbuf_ncat(&logbuf, str, p - s);
|
||||
strbuf_ncat(&logbuf, s, p - s);
|
||||
_log_finish(level);
|
||||
}
|
||||
}
|
||||
|
1
log.h
1
log.h
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define __SERVALD_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
extern unsigned int debug;
|
||||
|
||||
|
@ -1032,8 +1032,8 @@ long long parse_quantity(char *q)
|
||||
|
||||
void logServalPacket(int level, const char *file, unsigned int line, const char *function, const char *message, const unsigned char *packet, size_t len)
|
||||
{
|
||||
char *buffer;
|
||||
size_t size;
|
||||
char *buffer = NULL;
|
||||
size_t size = 0;
|
||||
FILE *m = open_memstream(&buffer, &size);
|
||||
if (m == NULL) {
|
||||
WHY_perror("open_memstream");
|
||||
@ -1045,4 +1045,6 @@ void logServalPacket(int level, const char *file, unsigned int line, const char
|
||||
WHY_perror("fclose");
|
||||
else
|
||||
logString(level, file, line, function, buffer);
|
||||
if (buffer)
|
||||
free(buffer);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user