mirror of
https://github.com/tstack/lnav
synced 2024-11-01 21:40:34 +00:00
parent
560c2d4ec3
commit
e3f28eaa43
@ -91,6 +91,7 @@ logfile::logfile(const string &filename, logfile_open_options &loo)
|
||||
}
|
||||
else {
|
||||
log_perror(fstat(this->lf_options.loo_fd, &this->lf_stat));
|
||||
this->lf_named_file = false;
|
||||
this->lf_valid_filename = false;
|
||||
}
|
||||
|
||||
@ -298,9 +299,10 @@ logfile::rebuild_result_t logfile::rebuild_index()
|
||||
}
|
||||
|
||||
// Check the previous stat against the last to see if things are wonky.
|
||||
if (st.st_size < this->lf_stat.st_size ||
|
||||
(this->lf_stat.st_size == st.st_size &&
|
||||
this->lf_stat.st_mtime != st.st_mtime)) {
|
||||
if (this->lf_named_file &&
|
||||
(st.st_size < this->lf_stat.st_size ||
|
||||
(this->lf_stat.st_size == st.st_size &&
|
||||
this->lf_stat.st_mtime != st.st_mtime))) {
|
||||
log_info("overwritten file detected, closing -- %s new: %" PRId64
|
||||
"/%" PRId64 " old: %" PRId64 "/%" PRId64,
|
||||
this->lf_filename.c_str(),
|
||||
|
@ -377,6 +377,7 @@ protected:
|
||||
|
||||
logfile_open_options lf_options;
|
||||
logfile_activity lf_activity;
|
||||
bool lf_named_file{true};
|
||||
bool lf_valid_filename;
|
||||
std::string lf_filename;
|
||||
std::string lf_basename;
|
||||
|
@ -1,6 +1,15 @@
|
||||
#! /bin/bash
|
||||
|
||||
|
||||
echo "Hi" | run_test ${lnav_test} -d /tmp/lnav.err -nt -w logfile_stdin.0.log \
|
||||
-c ':shexec sleep 1 && touch -t 200711030923 logfile_stdin.0.log'
|
||||
|
||||
check_output "piping to stdin is not working?" <<EOF
|
||||
2013-06-06T12:13:20.123 Hi
|
||||
2013-06-06T12:13:20.123 ---- END-OF-STDIN ----
|
||||
EOF
|
||||
|
||||
|
||||
cp ${srcdir}/logfile_syslog.0 truncfile.0
|
||||
chmod u+w truncfile.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user