diff options
| author | Rink Springer <rink@FreeBSD.org> | 2008-01-30 13:55:32 +0000 |
|---|---|---|
| committer | Rink Springer <rink@FreeBSD.org> | 2008-01-30 13:55:32 +0000 |
| commit | 868f9ca26ab4ac40f0c03e03390b7c549349e879 (patch) | |
| tree | 416fc212a14786ed8816b306f666a45d3411f17c /usr.sbin/watch | |
| parent | 3640040a14b5a60a199dda0bddc9fb1bfe1fbb1b (diff) | |
Notes
Diffstat (limited to 'usr.sbin/watch')
| -rw-r--r-- | usr.sbin/watch/watch.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index 732db3d27e54f..cc833ef38fd86 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; |
