From owner-freebsd-hackers Sat Jan 13 19:14:52 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 1C3ED37B400 for ; Sat, 13 Jan 2001 19:14:35 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0E3EW617016; Sat, 13 Jan 2001 19:14:32 -0800 (PST) Date: Sat, 13 Jan 2001 19:14:32 -0800 From: Alfred Perlstein To: "W.H.Scholten" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: pppd & mkdir diff Message-ID: <20010113191432.G7240@fw.wintelcom.net> References: <3A5C843C.794BDF32@xs4all.nl> <20010111132509.J7240@fw.wintelcom.net> <3A5EE6B1.41C67EA6@xs4all.nl> <20010112081422.U7240@fw.wintelcom.net> <3A6025F1.794BDF32@xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3A6025F1.794BDF32@xs4all.nl>; from whs@xs4all.nl on Sat, Jan 13, 2001 at 09:54:57AM +0000 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * W.H.Scholten [010113 01:57] wrote: > Alfred Perlstein wrote: > > [ mkdir ] > > > I'll commit the patch shortly. > > Here's a better patch, it checks for multiple slashes, so mkdir > /tmp/aa///bb//// will give: > > mkdir: /tmp/aa: No such file or directory > > Also, renamed the function to dirname as it does the same as dirname(1). Actually, there already exists a function called dirname in libc, dirname(3). Here's what I'm going to commit: Index: mkdir.c =================================================================== RCS file: /home/ncvs/src/bin/mkdir/mkdir.c,v retrieving revision 1.19 diff -u -u -r1.19 mkdir.c --- mkdir.c 1999/09/04 03:19:38 1.19 +++ mkdir.c 2001/01/14 03:14:51 @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -108,7 +109,10 @@ if (build(*argv, omode)) success = 0; } else if (mkdir(*argv, omode) < 0) { - warn("%s", *argv); + if (errno == ENOTDIR || errno == ENOENT) + warn("%s", dirname(*argv)); + else + warn("%s", *argv); success = 0; } else if (vflag) (void)printf("%s\n", *argv); Does this look ok to you? -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message