From: Amos Jeffries Date: Wed, 8 Aug 2012 07:21:13 +0000 (+1200) Subject: Windows: provide POSIX ABI wrapper for mkdir() X-Git-Tag: sourceformat-review-1~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f77e128dff4a9227500ecdf2480d2762cb6a51fc;p=thirdparty%2Fsquid.git Windows: provide POSIX ABI wrapper for mkdir() --- diff --git a/compat/os/mswin.h b/compat/os/mswin.h index 45bcf4bcb2..6561b41f94 100644 --- a/compat/os/mswin.h +++ b/compat/os/mswin.h @@ -97,7 +97,7 @@ typedef unsigned long ino_t; #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ #define lseek _lseeki64 #define memccpy _memccpy -#define mkdir(p) _mkdir(p) +#define mkdir(p,F) _mkdir((p)) #define mktemp _mktemp #endif #define pclose _pclose diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index ffd78f74da..b4bd61e732 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -899,14 +899,7 @@ CossSwapDir::create() if (::stat(path, &swap_sb) < 0) { debugs (47, 2, "COSS swap space space being allocated."); -#if _SQUID_MSWIN_ - - mkdir(path); -#else - mkdir(path, 0700); -#endif - } /* should check here for directories instead of files, and for file size diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index ef183af471..9c6fa87822 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -509,14 +509,7 @@ UFSSwapDir::createDirectory(const char *aPath, int should_exist) } else { fatalf("Swap directory %s is not a directory.", aPath); } - -#if _SQUID_MSWIN_ - - } else if (0 == mkdir(aPath)) { -#else - } else if (0 == mkdir(aPath, 0755)) { -#endif debugs(47, (should_exist ? 1 : 3), aPath << " created"); created = 1; } else { @@ -1117,14 +1110,7 @@ UFSSwapDir::DirClean(int swap_index) if (dir_pointer == NULL) { if (errno == ENOENT) { debugs(36, 0, "storeDirClean: WARNING: Creating " << p1); -#if _SQUID_MSWIN_ - - if (mkdir(p1) == 0) -#else - if (mkdir(p1, 0777) == 0) -#endif - return 0; } diff --git a/src/ssl/certificate_db.cc b/src/ssl/certificate_db.cc index 86eafffb46..3f8069aa07 100644 --- a/src/ssl/certificate_db.cc +++ b/src/ssl/certificate_db.cc @@ -286,18 +286,10 @@ void Ssl::CertificateDb::create(std::string const & db_path) std::string cert_full(db_path + "/" + cert_dir); std::string size_full(db_path + "/" + size_file); -#if _SQUID_MSWIN_ - if (mkdir(db_path.c_str())) -#else if (mkdir(db_path.c_str(), 0777)) -#endif throw std::runtime_error("Cannot create " + db_path); -#if _SQUID_MSWIN_ - if (mkdir(cert_full.c_str())) -#else if (mkdir(cert_full.c_str(), 0777)) -#endif throw std::runtime_error("Cannot create " + cert_full); std::ofstream size(size_full.c_str());