Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Feb 2010 02:09:32 -0500 (EST)
From:      "Mikhail T." <mi@aldan.algebra.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/143834: mkdir(2) may set errno incorrectly
Message-ID:  <201002120709.o1C79WHj080185@aldan.algebra.com>
Resent-Message-ID: <201002120730.o1C7U1Ot031470@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



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