diff options
author | Christian S.J. Peron <csjp@FreeBSD.org> | 2004-05-29 21:03:00 +0000 |
---|---|---|
committer | Christian S.J. Peron <csjp@FreeBSD.org> | 2004-05-29 21:03:00 +0000 |
commit | 0f27b907705bfc72225c92f1d36146897af708c3 (patch) | |
tree | f5b59e008e00400d39d028742a308e6bcac77100 /usr.sbin/watch | |
parent | 927b4810012d83955d93d49fdd282646a782a2b9 (diff) | |
download | src-0f27b907705bfc72225c92f1d36146897af708c3.tar.gz src-0f27b907705bfc72225c92f1d36146897af708c3.zip |
Remove constant which makes the assumption that the length of
_PATH_DEV will never change. In the un-likely event that _PATH_DEV
should ever change, watch(8) would have broke because of a
mis-generated device name.
Approved by: bmilekic (mentor)
Pointed out by: Yvan Boily
Notes
Notes:
svn path=/head/; revision=129849
Diffstat (limited to 'usr.sbin/watch')
-rw-r--r-- | usr.sbin/watch/watch.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index bca50967299a..1e630dbc85a3 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; |