summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorrink <rink@FreeBSD.org>2008-01-30 13:55:32 +0000
committerrink <rink@FreeBSD.org>2008-01-30 13:55:32 +0000
commita0c6a1a4d5c42c8a4df5574a44484788f879862c (patch)
tree416fc212a14786ed8816b306f666a45d3411f17c /usr.sbin
parent43c3361485263c7f1fda0c7fc3639fee6b53bbf0 (diff)
downloadFreeBSD-src-a0c6a1a4d5c42c8a4df5574a44484788f879862c.zip
FreeBSD-src-a0c6a1a4d5c42c8a4df5574a44484788f879862c.tar.gz
Allow watch(8) to use more than 10 snp* devices. This limitation was purely
due to the way watch(8) looks for available snoop devices. PR: bin/118286 Submitted by: Mykola Zubach <zuborg@advancedhosters.com> Reviewed by: rwatson, csjp, imp (all a long time ago) Approved by: imp (mentor) (long time ago) MFC after: 1 week
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/watch/watch.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c
index 732db3d..cc833ef 100644
--- a/usr.sbin/watch/watch.c
+++ b/usr.sbin/watch/watch.c
@@ -152,19 +152,18 @@ fatal(int error, const char *buf)
static int
open_snp(void)
{
- char snp[] = {_PATH_DEV "snpX"};
- char c;
- int f, mode, pos;
+ char snp[] = {_PATH_DEV "snpXXX"};
+ int f, mode, pos, c;
- pos = strlen(snp) - 1;
+ pos = strlen(snp) - 3;
if (opt_write)
mode = O_RDWR;
else
mode = O_RDONLY;
if (opt_snpdev == NULL)
- for (c = '0'; c <= '9'; c++) {
- snp[pos] = c;
+ for (c = 0; c <= 999; c++) {
+ snprintf(snp+pos, 4, "%d", c);
if ((f = open(snp, mode)) < 0) {
if (errno == EBUSY)
continue;
OpenPOWER on IntegriCloud