mirror of
https://github.com/tstack/lnav.git
synced 2024-08-17 08:50:41 +03:00
fix an error when parsing json logs
This commit is contained in:
parent
169a5bd732
commit
9848582239
@ -391,11 +391,13 @@ void load_formats(std::vector<std::string> &errors)
|
||||
string format_path = dotlnav_path("formats/*/*.json");
|
||||
static_root_mem<glob_t, globfree> gl;
|
||||
|
||||
log_info("loading formats from path: %s", format_path.c_str());
|
||||
if (glob(format_path.c_str(), 0, NULL, gl.inout()) == 0) {
|
||||
for (int lpc = 0; lpc < (int)gl->gl_pathc; lpc++) {
|
||||
string filename(gl->gl_pathv[lpc]);
|
||||
auto_fd fd;
|
||||
|
||||
log_info("loading formats from file: %s", filename.c_str());
|
||||
yajlpp_parse_context ypc(filename, format_handlers);
|
||||
if ((fd = open(gl->gl_pathv[lpc], O_RDONLY)) == -1) {
|
||||
char errmsg[1024];
|
||||
|
@ -256,6 +256,7 @@ throw (line_buffer::error, logfile::error)
|
||||
if (len > 0 && line[len - 1] == '\n') {
|
||||
this->lf_partial_line = false;
|
||||
line[len - 1] = '\0';
|
||||
len -= 1;
|
||||
}
|
||||
else {
|
||||
this->lf_partial_line = true;
|
||||
|
Loading…
Reference in New Issue
Block a user