Avoid a corrupt timestamp on the console
PR: 51587 Submitted by: Dmitry Sivachenko <mitya@cavia.pp.ru> Approved by: re (rwatson) MFC after: 3 days
This commit is contained in:
parent
a22139f98d
commit
cc22785824
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115109
@ -873,6 +873,8 @@ logmsg(int pri, const char *msg, const char *from, int flags)
|
||||
f->f_file = open(ctty, O_WRONLY, 0);
|
||||
|
||||
if (f->f_file >= 0) {
|
||||
(void)strlcpy(f->f_lasttime, timestamp,
|
||||
sizeof(f->f_lasttime));
|
||||
fprintlog(f, flags, msg);
|
||||
(void)close(f->f_file);
|
||||
}
|
||||
@ -911,7 +913,8 @@ logmsg(int pri, const char *msg, const char *from, int flags)
|
||||
(flags & MARK) == 0 && msglen == f->f_prevlen &&
|
||||
!strcmp(msg, f->f_prevline) &&
|
||||
!strcasecmp(from, f->f_prevhost)) {
|
||||
(void)strlcpy(f->f_lasttime, timestamp, 16);
|
||||
(void)strlcpy(f->f_lasttime, timestamp,
|
||||
sizeof(f->f_lasttime));
|
||||
f->f_prevcount++;
|
||||
dprintf("msg repeated %d times, %ld sec of %d\n",
|
||||
f->f_prevcount, (long)(now - f->f_time),
|
||||
@ -932,7 +935,8 @@ logmsg(int pri, const char *msg, const char *from, int flags)
|
||||
fprintlog(f, 0, (char *)NULL);
|
||||
f->f_repeatcount = 0;
|
||||
f->f_prevpri = pri;
|
||||
(void)strlcpy(f->f_lasttime, timestamp, 16);
|
||||
(void)strlcpy(f->f_lasttime, timestamp,
|
||||
sizeof(f->f_lasttime));
|
||||
(void)strlcpy(f->f_prevhost, from,
|
||||
sizeof(f->f_prevhost));
|
||||
if (msglen < MAXSVLINE) {
|
||||
|
Loading…
Reference in New Issue
Block a user