kern/143834: mkdir(2) may set errno incorrectly

Mikhail T. mi at aldan.algebra.com
Fri Feb 12 07:30:02 UTC 2010


>Number:         143834
>Category:       kern
>Synopsis:       mkdir(2) may set errno incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 12 07:30:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail T.
>Release:        FreeBSD 7.2-STABLE amd64
>Organization:
Virtual Estates, Inc. ( http://sybpipe.com/ )
>Environment:
System: FreeBSD aldan.algebra.com 7.2-STABLE FreeBSD 7.2-STABLE #3: Sun Dec 20 20:10:12 EST 2009 mi at aldan.algebra.com:/meow/obj/var/src/sys/SILVER-SMP amd64

>Description:
	When the directory to be created is "/", mkdir(2) will set errno
	to EISDIR instead of EEXISTS.

>How-To-Repeat:

	Compile and run this program:

		#include <err.h>
		#include <stdio.h>
		#include <sys/stat.h>

		int
		main(int argc, char *argv[])
		{
			mkdir("/", 0666);

			warn("mkdir /");

			mkdir("/tmp", 0666);

			warn("mkdir /tmp");

			return 0;
		}

	You'll see the following inconsistency:

		t: mkdir /: Is a directory
		t: mkdir /tmp: File exists

	It should be "File exists" for both...
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list