From owner-freebsd-hackers Sat Jan 13 22:21:18 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id EA45037B400 for ; Sat, 13 Jan 2001 22:20:59 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0E6Jf121198; Sat, 13 Jan 2001 22:19:41 -0800 (PST) Date: Sat, 13 Jan 2001 22:19:41 -0800 From: Alfred Perlstein To: Warner Losh Cc: "W.H.Scholten" , freebsd-hackers@FreeBSD.ORG Subject: Re: pppd & mkdir diff Message-ID: <20010113221941.L7240@fw.wintelcom.net> References: <3A6025F1.794BDF32@xs4all.nl> <3A5C843C.794BDF32@xs4all.nl> <20010111132509.J7240@fw.wintelcom.net> <3A5EE6B1.41C67EA6@xs4all.nl> <20010112081422.U7240@fw.wintelcom.net> <3A6025F1.794BDF32@xs4all.nl> <200101140355.f0E3tIs95857@harmony.village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200101140355.f0E3tIs95857@harmony.village.org>; from imp@harmony.village.org on Sat, Jan 13, 2001 at 08:55:18PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Warner Losh [010113 19:55] wrote: > In message <3A6025F1.794BDF32@xs4all.nl> "W.H.Scholten" writes: > : + while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; > > Style(9) says write this like: > while (path[ strlen(path)-1 ] == '/') > path[ strlen(path)-1 ] = 0; > > : + > : + slash = strrchr(path, '/'); > : + if (slash) { > : + *slash = 0; > > this is not an integer, but rather a character. *slash = '\0'; please. > > : + while (path[ strlen(path)-1 ] == '/') path[ strlen(path)-1 ] = 0; > > Ditto. > > > But why do this at all? > > 'mkdir /a/b/////d/e' is required by posix to create /a/b/d/e if /a/b/d > exists. This isn't the point, if you do this: mkdir /someplacethatdoesntexist/foo you'll get: mkdir: /someplacethatdoesntexist/foo: No such file or directory What the patch does is make the error output say: mkdir: /someplacethatdoesntexist: No such file or directory Which makes a bit more sense than telling you it failed because the thing that you know doesn't exist, doesn't exist. :) You missed my latest email on it, basically I can just call dirname(3) on the path depending on the errno to give a more reasonable error message. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message