Date: Sat, 13 Jan 2001 22:19:41 -0800 From: Alfred Perlstein <bright@wintelcom.net> To: Warner Losh <imp@harmony.village.org> Cc: "W.H.Scholten" <whs@xs4all.nl>, freebsd-hackers@FreeBSD.ORG Subject: Re: pppd & mkdir diff Message-ID: <20010113221941.L7240@fw.wintelcom.net> In-Reply-To: <200101140355.f0E3tIs95857@harmony.village.org>; from imp@harmony.village.org on Sat, Jan 13, 2001 at 08:55:18PM -0700 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>
next in thread | previous in thread | raw e-mail | index | archive | help
* Warner Losh <imp@harmony.village.org> [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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010113221941.L7240>