From owner-freebsd-questions@FreeBSD.ORG Fri Mar 9 00:10:23 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4CD7106566C for ; Fri, 9 Mar 2012 00:10:23 +0000 (UTC) (envelope-from conrads@cox.net) Received: from eastrmfepo203.cox.net (eastrmfepo203.cox.net [68.230.241.218]) by mx1.freebsd.org (Postfix) with ESMTP id 58BD48FC13 for ; Fri, 9 Mar 2012 00:10:23 +0000 (UTC) Received: from eastrmimpo109.cox.net ([68.230.241.222]) by eastrmfepo203.cox.net (InterMail vM.8.01.04.00 201-2260-137-20101110) with ESMTP id <20120309001017.BKCU18532.eastrmfepo203.cox.net@eastrmimpo109.cox.net> for ; Thu, 8 Mar 2012 19:10:17 -0500 Received: from serene.no-ip.org ([98.164.84.176]) by eastrmimpo109.cox.net with bizsmtp id jCAH1i0093oG0Ji02CAHNo; Thu, 08 Mar 2012 19:10:17 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020206.4F594A69.00C4,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=1.1 cv=XApQh1NwS0kk9y5VQg1IQe/r8Q/VmA0LM7eT14yPc6s= c=1 sm=1 a=7lvZSXHooPIA:10 a=G8Uczd0VNMoA:10 a=kj9zAlcOel0A:10 a=qwmwShWo9LG1Fa0ONy89vg==:17 a=kviXuzpPAAAA:8 a=H7le-MN28uZaesFayUgA:9 a=CjuIK1q_8ugA:10 a=4vB-4DCPJfMA:10 a=qwmwShWo9LG1Fa0ONy89vg==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none Received: from cox.net (localhost [127.0.0.1]) by serene.no-ip.org (8.14.5/8.14.5) with ESMTP id q290AGsJ008514 for ; Thu, 8 Mar 2012 18:10:16 -0600 (CST) (envelope-from conrads@cox.net) Date: Thu, 8 Mar 2012 18:10:11 -0600 From: "Conrad J. Sabatier" To: freebsd-questions@FreeBSD.org Message-ID: <20120308181011.0b097de1@cox.net> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Subject: realpath(3): a curiosity question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2012 00:10:23 -0000 I'm just wondering if anyone knows the rationale behind the differing return codes from realpath() for non-existent paths, depending on whether the non-existent element of a path is at the end of the path or if it occurs somewhere further up the chain. Not asking that it be changed, mind you. Just wondering why it was decided to distinguish between these two cases. From the programmer's perspective, this is something of a minor annoyance, as running a non-existent path through realpath() may or may not return NULL, and therefore still requires additional code to further validate the path returned in the non-NULL case. Granted, the stated purpose of this function is not to verify a path's existence, but nonetheless, having a function that might be called non-deterministic in the results it returns just seems, well, *bad* to me (for lack of a better word at the moment). Does anyone have any idea what the reasoning is behind this design? -- Conrad J. Sabatier conrads@cox.net