summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/watch/watch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c
index bca5096..1e630db 100644
--- a/usr.sbin/watch/watch.c
+++ b/usr.sbin/watch/watch.c
@@ -154,8 +154,9 @@ open_snp(void)
{
char snp[] = {_PATH_DEV "snpX"};
char c;
- int f, mode;
+ int f, mode, pos;
+ pos = strlen(snp) - 1;
if (opt_write)
mode = O_RDWR;
else
@@ -163,7 +164,7 @@ open_snp(void)
if (opt_snpdev == NULL)
for (c = '0'; c <= '9'; c++) {
- snp[8] = c;
+ snp[pos] = c;
if ((f = open(snp, mode)) < 0)
continue;
return f;
OpenPOWER on IntegriCloud