Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2002 16:33:28 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Alfred Perlstein <bright@mu.org>
Cc:        <fs@FreeBSD.ORG>
Subject:   Re: mkdir / == odd
Message-ID:  <20020219162133.D858-100000@gamplex.bde.org>
In-Reply-To: <20020218132751.GX12136@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 18 Feb 2002, Alfred Perlstein wrote:

> # mkdir /
> mkdir: /: Is a directory
>
> shouldn't mkdir get a EEXIST error back?

Looks like I didn't fix this special case when I fixed trailing slash
handling in rev.1.8 of vfs_lookup.c.

> this patch to mkdir also fixes it.

Um, kernel bugs can't be fixed in userland.

> Index: mkdir.c
> ===================================================================
> RCS file: /home/ncvs/src/bin/mkdir/mkdir.c,v
> retrieving revision 1.23
> diff -u -r1.23 mkdir.c
> --- mkdir.c	5 Feb 2002 21:55:12 -0000	1.23
> +++ mkdir.c	18 Feb 2002 13:28:06 -0000
> @@ -143,7 +143,7 @@
>  	p = path;
>  	oumask = 0;
>  	retval = 0;
> -	if (p[0] == '/')		/* Skip leading '/'. */
> +	while (p[0] == '/')		/* Skip leading '/'. */
>  		++p;
>  	for (first = 1, last = 0; !last ; ++p) {
>  		if (p[0] == '\0')
>

Skipping even one slash here probably breaks mkdir(1) on systems where a
leading "//" is special.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020219162133.D858-100000>