summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2006-02-27 19:13:47 +0000
committerdwmalone <dwmalone@FreeBSD.org>2006-02-27 19:13:47 +0000
commitf15451ccbd8b06992fcbc18207d8c4edda6d1042 (patch)
treeb950f7fa4cbd315245e29cb24b768fde79dcd07b
parent4056fdd24c2ed5bcc0257921a9e5d8277cabc4f9 (diff)
downloadFreeBSD-src-f15451ccbd8b06992fcbc18207d8c4edda6d1042.zip
FreeBSD-src-f15451ccbd8b06992fcbc18207d8c4edda6d1042.tar.gz
Avoid moving onto a new line while testing if there is a syslog priority
in the buffer. This isn't exactly the patch that Stephen submitted, but is based on one of his suggestions. PR: 93841 Submitted by: Stephen Montgomery-Smith <stephen@math.missouri.edu> MFC after: 2 weeks
-rw-r--r--sbin/dmesg/dmesg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index d1f7ef5..f2e513f 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/msgbuf.h>
#include <sys/sysctl.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -177,7 +178,7 @@ main(int argc, char *argv[])
nextp++;
/* Skip ^<[0-9]+> syslog sequences. */
- if (*p == '<') {
+ if (*p == '<' && isdigit(*(p+1))) {
errno = 0;
pri = strtol(p + 1, &q, 10);
if (*q == '>' && pri >= 0 && pri < INT_MAX &&
OpenPOWER on IntegriCloud