util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmesg: avoid mess at the end of dmesg output
@ 2011-08-10 12:16 Petr Uzel
  2011-08-15 12:35 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Uzel @ 2011-08-10 12:16 UTC (permalink / raw)
  To: util-linux

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

Since util-linux commit a7ee94f2204011f26232ed3133514bf6e0d4a62c,
dmesg incorrectly calculates number of bytes that are remaining in the
buffer in get_next_record(). This could, under specific circumstances,
cause printing mess at the end of dmesg output:

> dmesg | tail
[ 1191.478725] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
[ 1205.588331] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
\xffffffba\xffffffba

Reported-by: Glenn Doig <doiggl@velocitynet.com.au>
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710417

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 sys-utils/dmesg.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 94f8c11..705269d 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -494,6 +494,8 @@ static int get_next_record(struct dmesg_control *ctl, struct dmesg_record *rec)
 
 		rec->next_size -= end - rec->next;
 		rec->next = rec->next_size > 0 ? end + 1 : NULL;
+		if (rec->next_size > 0)
+			rec->next_size--;
 
 		return 0;
 	}
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmesg: avoid mess at the end of dmesg output
  2011-08-10 12:16 [PATCH] dmesg: avoid mess at the end of dmesg output Petr Uzel
@ 2011-08-15 12:35 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2011-08-15 12:35 UTC (permalink / raw)
  To: util-linux

On Wed, Aug 10, 2011 at 02:16:40PM +0200, Petr Uzel wrote:
>  sys-utils/dmesg.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-15 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-10 12:16 [PATCH] dmesg: avoid mess at the end of dmesg output Petr Uzel
2011-08-15 12:35 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).