From 42d6cdd371dc482bf423737a8024cdb064f98b87 Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Mon, 25 Feb 2002 09:17:44 +0000 Subject: [PATCH] Fix a bug introduced in rev.1.23 - for some reason mkdir("/", ...) system call returns `EISDIR', not `EEXIST', so that be prepared for that. This should fix number of ports, that often call `mkdir -p //usr/local/foobar'. This is just a quick workaround, the real fix would be either to avoid calling mkdir("/", ...) or fix VFS code to return consistent errno for this case. --- bin/mkdir/mkdir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mkdir/mkdir.c b/bin/mkdir/mkdir.c index 17e7ccf446fc..5f865883e91b 100644 --- a/bin/mkdir/mkdir.c +++ b/bin/mkdir/mkdir.c @@ -174,7 +174,7 @@ build(char *path, mode_t omode) if (last) (void)umask(oumask); if (mkdir(path, last ? omode : S_IRWXU | S_IRWXG | S_IRWXO) < 0) { - if (errno == EEXIST) { + if (errno == EEXIST || errno == EISDIR) { if (stat(path, &sb) < 0) { warn("%s", path); retval = 1;