From owner-freebsd-arch Thu May 17 5:15:27 2001 Delivered-To: freebsd-arch@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 9A8EB37B424 for ; Thu, 17 May 2001 05:15:23 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 43740 invoked by uid 1000); 17 May 2001 12:14:43 -0000 Date: Thu, 17 May 2001 15:14:42 +0300 From: Peter Pentchev To: Ruslan Ermilov Cc: Nik Clayton , arch@FreeBSD.ORG Subject: Re: [PATCH] syscons ioctl() to grab text mode buffer Message-ID: <20010517151442.B39834@ringworld.oblivion.bg> Mail-Followup-To: Ruslan Ermilov , Nik Clayton , arch@FreeBSD.ORG References: <20010517121902.A3047@catkin.nothing-going-on.org> <20010517145209.C55371@sunbay.com> <20010517150823.A39834@ringworld.oblivion.bg> <20010517151137.E55371@sunbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010517151137.E55371@sunbay.com>; from ru@FreeBSD.ORG on Thu, May 17, 2001 at 03:11:37PM +0300 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, May 17, 2001 at 03:11:37PM +0300, Ruslan Ermilov wrote: > On Thu, May 17, 2001 at 03:08:23PM +0300, Peter Pentchev wrote: > > On Thu, May 17, 2001 at 02:52:09PM +0300, Ruslan Ermilov wrote: > > > On Thu, May 17, 2001 at 12:19:02PM +0100, Nik Clayton wrote: > > > > Two things for review. > > > > > > > [...] > > > > The second, scrshot.c uses the ioctl to dump the contents of the video > > > > memory to stdout. Usage is > > > > > > > > scrshot /dev/ttyv0 > shot.scr > > > > > > > There are some style(9) and -security issues with this: > > > > > > --- scrshot.c~ Thu May 17 14:42:40 2001 > > > +++ scrshot.c Thu May 17 14:50:22 2001 > > [snip[ > > > - result = ioctl(fd, CONS_GETINFO, &info); > > > - if (result != 0) { > > > - perror("getinfo failed"); > > > - exit(1); > > > - } > > > + if (ioctl(fd, CONS_GETINFO, &info) == -1) > > > + err(1, "ioctl(CONS_GETINFO)"); > > > > Wouldn't it be better to check for < 0 here, too? > > More compatible in the long run.. > > > Nope, see RETURN VALUES in ioctl(2) manpage; see POSIX then. > All sysctl's return -1 on error, not <0. Oh ok, I didn't know that the explicit -1 return value was standardized. G'luck, Peter -- I am the meaning of this sentence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message