From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout.scc.kit.edu (scc-mailout.scc.kit.edu [129.13.185.201]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p32MKFhR014997 for ; Sat, 2 Apr 2011 18:20:17 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by scc-mailout-01.scc.kit.edu with esmtp (Exim 4.72 #1) id 1Q69B0-0008Rw-0C; Sun, 03 Apr 2011 00:20:14 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1Q69B0-0008VA-12; Sun, 03 Apr 2011 00:20:14 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1Q69Az-0008AP-WB; Sun, 03 Apr 2011 00:20:14 +0200 Received: from schwarze by usta.de with local (Exim 4.72) (envelope-from ) id 1Q69Az-0005mW-OU; Sun, 03 Apr 2011 00:20:13 +0200 Date: Sun, 3 Apr 2011 00:20:13 +0200 From: Ingo Schwarze To: discuss@mdocml.bsd.lv Cc: Yuri Pankov Subject: Re: uname() in mdoc_validate.c on Solaris Message-ID: <20110402222013.GO6587@iris.usta.de> References: <20110331100458.GA1293@darklight.org.ru> <4D945619.1060508@bsd.lv> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D945619.1060508@bsd.lv> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Kristaps, hi Yuri, Kristaps Dzonsons wrote on Thu, Mar 31, 2011 at 12:23:21PM +0200: > Yuri Pankov wrote: >> uname(2) on Solaris (OpenSolaris, OpenIndiana, Solaris 11 Express) >> states: >> >> RETURN VALUES >> Upon successful completion, a non-negative value is >> returned. Otherwise, -1 is returned and errno is set to >> indicate the error. Hm, indeed, that is not just Solaris, but POSIX, see here: http://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html > This surprises me, as I usually do (-1 == syscall()). And indeed, > it seems this was lost in version 1.136 of mdoc_validate.c: > > http://mdocml.bsd.lv/cgi-bin/cvsweb/mdoc_validate.c.diff?r1=1.135&r2=1.136&cvsroot=mdocml&f=h > > Is there a technical reason for this (according to the CVS log, I > was merging your changes)? If not, I'll revert to the specific > check for -1. Actually, i did the change on purpose given the text in the OpenBSD uname(3) manual: RETURN VALUES If uname() is successful, 0 is returned; otherwise, -1 is returned and errno is set appropriately. Hence, i regarded requiring zero as safer. However, in view of the POSIX text, my change is clearly wrong. >> Could we possibly change >> >> if (uname(&utsname)) { >> >> to >> >> if (uname(&utsname) == -1) { >> >> to make .Os without arguments work on these OSes? Yes. Kristaps, please go ahead. > Yuri, thanks for the note! Indeed, and sorry for inadvertently introducing a POSIX violation. Yours, Ingo -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv