diff options
author | Jairo <kidandcat@gmail.com> | 2019-04-15 09:42:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 09:42:24 +0200 |
commit | 7befaaf3c3e52bce6d92b01759bb13bf5b4e2349 (patch) | |
tree | ee827101d5c2149140c495ef1f67c8eca6931677 /contrib | |
parent | 19bd077987ff26a4cb108edde5eaf970837aa1f0 (diff) | |
download | libarchive-7befaaf3c3e52bce6d92b01759bb13bf5b4e2349.tar.gz |
Windows support
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/untar.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/contrib/untar.c b/contrib/untar.c index 3d954f63..34b06c7f 100644 --- a/contrib/untar.c +++ b/contrib/untar.c @@ -36,6 +36,10 @@ /* This is for mkdir(); this may need to be changed for some platforms. */ #include <sys/stat.h> /* For mkdir() */ +#if defined(_WIN32) +#include <windows.h> +#endif + /* Parse an octal number, ignoring leading and trailing nonsense. */ static int parseoct(const char *p, size_t n) @@ -78,7 +82,11 @@ create_dir(char *pathname, int mode) pathname[strlen(pathname) - 1] = '\0'; /* Try creating the directory. */ - r = mkdir(pathname, mode); + #if defined(_WIN32) + r = _mkdir(pathname); + #else + r = mkdir(pathname, mode); + #endif if (r != 0) { /* On failure, try creating parent directory. */ @@ -87,7 +95,11 @@ create_dir(char *pathname, int mode) *p = '\0'; create_dir(pathname, 0755); *p = '/'; - r = mkdir(pathname, mode); + #if defined(_WIN32) + r = _mkdir(pathname); + #else + r = mkdir(pathname, mode); + #endif } } if (r != 0) |