summaryrefslogtreecommitdiff
path: root/mkdir_r.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavier.delcampo@orain.io>2020-10-13 16:23:12 +0200
committerXavier Del Campo Romero <xavier.delcampo@orain.io>2020-10-13 16:23:12 +0200
commit3a6c25efebc509a107accb4d27ea8f5dc7ca0d17 (patch)
treec911696ddbe8d1cb0b42f0a7ec78e783bff8a814 /mkdir_r.c
parent6930a91f26c465903a139614c81637716e81cf3b (diff)
Add support for Win32
Diffstat (limited to 'mkdir_r.c')
-rw-r--r--mkdir_r.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/mkdir_r.c b/mkdir_r.c
index 20920e3..b91daae 100644
--- a/mkdir_r.c
+++ b/mkdir_r.c
@@ -14,13 +14,9 @@
limitations under the License.
*/
#include "mkdir_r.h"
+#include "mkdir_r_private.h"
#include <string.h>
#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
#include <stdio.h>
#include <errno.h>
@@ -66,19 +62,7 @@ int mkdir_r(const char *const path)
if (!*dir)
/* Path starting with delimiter character. */
;
- else if (!access(dir, 0))
- {
- struct stat sb;
-
- if (stat(dir, &sb))
- goto exit;
- else if (!(sb.st_mode & S_IFDIR))
- {
- errno = ENOTDIR;
- goto exit;
- }
- }
- else if (mkdir(dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
+ else if (mkdir_r_port(dir))
goto exit;
dir = dup;