aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/watch
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2008-08-15 13:07:07 +0000
committerEd Schouten <ed@FreeBSD.org>2008-08-15 13:07:07 +0000
commit2e37c8eacb89146024f974f3391fea61d9ee1ea5 (patch)
tree97fa442f4619eff0b084537b42202b5555ff9c24 /usr.sbin/watch
parent854d77bdd657e1331f1fec1e9394bcb3f7afcab5 (diff)
Notes
Diffstat (limited to 'usr.sbin/watch')
-rw-r--r--usr.sbin/watch/watch.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c
index cc833ef38fd8..388614e08c18 100644
--- a/usr.sbin/watch/watch.c
+++ b/usr.sbin/watch/watch.c
@@ -152,30 +152,21 @@ fatal(int error, const char *buf)
static int
open_snp(void)
{
- char snp[] = {_PATH_DEV "snpXXX"};
- int f, mode, pos, c;
+ int f, mode;
- pos = strlen(snp) - 3;
if (opt_write)
mode = O_RDWR;
else
mode = O_RDONLY;
if (opt_snpdev == NULL)
- for (c = 0; c <= 999; c++) {
- snprintf(snp+pos, 4, "%d", c);
- if ((f = open(snp, mode)) < 0) {
- if (errno == EBUSY)
- continue;
- err(1, "open %s", snp);
- }
- return f;
- }
+ f = open(_PATH_DEV "snp", mode);
else
- if ((f = open(opt_snpdev, mode)) != -1)
- return (f);
- fatal(EX_OSFILE, "cannot open snoop device");
- return (0);
+ f = open(opt_snpdev, mode);
+ if (f == -1)
+ fatal(EX_OSFILE, "cannot open snoop device");
+
+ return (f);
}