From owner-cvs-src@FreeBSD.ORG Tue Aug 10 01:49:47 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2684E16A4CE; Tue, 10 Aug 2004 01:49:47 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F03F43D41; Tue, 10 Aug 2004 01:49:47 +0000 (GMT) (envelope-from csjp@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i7A1nliB089226; Tue, 10 Aug 2004 01:49:47 GMT (envelope-from csjp@repoman.freebsd.org) Received: (from csjp@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i7A1nkDt089225; Tue, 10 Aug 2004 01:49:46 GMT (envelope-from csjp) Message-Id: <200408100149.i7A1nkDt089225@repoman.freebsd.org> From: "Christian S.J. Peron" Date: Tue, 10 Aug 2004 01:49:46 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.sbin/watch watch.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2004 01:49:47 -0000 csjp 2004-08-10 01:49:46 UTC FreeBSD src repository Modified files: usr.sbin/watch watch.c Log: 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) Revision Changes Path 1.31 +7 -3 src/usr.sbin/watch/watch.c