]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
By default, the watch utility will attempt to open /dev/snp0, if
authorcsjp <csjp@FreeBSD.org>
Tue, 10 Aug 2004 01:49:46 +0000 (01:49 +0000)
committercsjp <csjp@FreeBSD.org>
Tue, 10 Aug 2004 01:49:46 +0000 (01:49 +0000)
commitda80d2d49d209d69172bd6453ddc3967cff72bfb
tree0e18b0293bc5fc8ad411546e9e30c42651f89143
parent7e21ce666c82537fdaf6354b41e681ecfd85640c
By default, the watch utility will attempt to open /dev/snp0, if
another process already has /dev/snp0 open, the snp(4) will return
EBUSY, in which case watch will try to open /dev/snp1..9. Currently
watch does not check errno to see if the failure was a result of EBUSY.

This results in watch making futile attempts to open snp0..snp9 even
though devices may not exist or the caller does not have permissions
to access the device.

In addition to this, it attempts to setup the screen for snooping even
though it may not ever get an snp device.

So this patch does two things
1) Checks errno for EBUSY, if open(2) fails for another reason
   print that reason and exit.
2) setup the terminal for snooping after the snp descriptor has
   been obtained.

Approved by: bmilekic (mentor)
usr.sbin/watch/watch.c