From owner-freebsd-arch Thu May 17 10: 9:46 2001 Delivered-To: freebsd-arch@freebsd.org Received: from dragon.nuxi.com (trang.nuxi.com [209.152.133.57]) by hub.freebsd.org (Postfix) with ESMTP id 87A5037B422; Thu, 17 May 2001 10:09:42 -0700 (PDT) (envelope-from obrien@NUXI.com) Received: (from obrien@localhost) by dragon.nuxi.com (8.11.3/8.11.1) id f4HH9dn60653; Thu, 17 May 2001 10:09:39 -0700 (PDT) (envelope-from obrien) Date: Thu, 17 May 2001 10:09:39 -0700 From: "David O'Brien" To: Peter Pentchev Cc: Ruslan Ermilov , Nik Clayton , arch@FreeBSD.ORG Subject: Re: [PATCH] syscons ioctl() to grab text mode buffer Message-ID: <20010517100939.A60619@dragon.nuxi.com> Reply-To: obrien@FreeBSD.ORG References: <20010517121902.A3047@catkin.nothing-going-on.org> <20010517145209.C55371@sunbay.com> <20010517150823.A39834@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010517150823.A39834@ringworld.oblivion.bg>; from roam@orbitel.bg on Thu, May 17, 2001 at 03:08:23PM +0300 X-Operating-System: FreeBSD 5.0-CURRENT Organization: The NUXI BSD group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, May 17, 2001 at 03:08:23PM +0300, Peter Pentchev wrote: > > - 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.. Uh.. why? RETURN VALUES If an error has occurred, a value of -1 is returned and errno is set to indicate the error. the return is set to "-1", not -20, not -100; but -1, peroid. Or were you planning on changing this in the future? Using "< 0" is just sloppy coding and it even caused me big problems porting bits to 286 Xenix in the past. -- -- David (obrien@FreeBSD.org) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message