|
@@ -54,7 +54,7 @@
|
|
|
#define LOCK_ATTEMPTS 50
|
|
|
#define LOCK_WAIT 200000
|
|
|
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
#include <windows.h>
|
|
|
#include <conio.h>
|
|
|
#define sleep(x) Sleep(x*1000)
|
|
@@ -178,7 +178,7 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil
|
|
|
|
|
|
static int __mkdir(const char* path, int mode)
|
|
|
{
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
return mkdir(path);
|
|
|
#else
|
|
|
return mkdir(path, mode);
|
|
@@ -207,7 +207,7 @@ static int mkdir_with_parents(const char *dir, int mode)
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
static int win32err_to_errno(int err_value)
|
|
|
{
|
|
|
switch (err_value) {
|
|
@@ -224,7 +224,7 @@ static int win32err_to_errno(int err_value)
|
|
|
static int remove_file(const char* path)
|
|
|
{
|
|
|
int e = 0;
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
if (!DeleteFile(path)) {
|
|
|
e = win32err_to_errno(GetLastError());
|
|
|
}
|
|
@@ -239,7 +239,7 @@ static int remove_file(const char* path)
|
|
|
static int remove_directory(const char* path)
|
|
|
{
|
|
|
int e = 0;
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
if (!RemoveDirectory(path)) {
|
|
|
e = win32err_to_errno(GetLastError());
|
|
|
}
|
|
@@ -773,7 +773,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
|
|
|
uint32_t bytes = 0;
|
|
|
char *localfile = string_build_path(backup_dir, path, NULL);
|
|
|
char buf[32768];
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
struct _stati64 fst;
|
|
|
#else
|
|
|
struct stat fst;
|
|
@@ -784,7 +784,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
|
|
|
int errcode = -1;
|
|
|
int result = -1;
|
|
|
uint32_t length;
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
uint64_t total;
|
|
|
uint64_t sent;
|
|
|
#else
|
|
@@ -815,7 +815,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
|
|
|
goto leave_proto_err;
|
|
|
}
|
|
|
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
if (_stati64(localfile, &fst) < 0)
|
|
|
#else
|
|
|
if (stat(localfile, &fst) < 0)
|
|
@@ -1348,7 +1348,7 @@ static void mb2_copy_directory_by_path(const char *src, const char *dst)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
#define BS_CC '\b'
|
|
|
#define my_getch getch
|
|
|
#else
|
|
@@ -1535,7 +1535,7 @@ int main(int argc, char *argv[])
|
|
|
/* we need to exit cleanly on running backups and restores or we cause havok */
|
|
|
signal(SIGINT, clean_exit);
|
|
|
signal(SIGTERM, clean_exit);
|
|
|
-#ifndef WIN32
|
|
|
+#ifndef _WIN32
|
|
|
signal(SIGQUIT, clean_exit);
|
|
|
signal(SIGPIPE, SIG_IGN);
|
|
|
#endif
|
|
@@ -2324,7 +2324,7 @@ checkpoint:
|
|
|
/* device wants to know how much disk space is available on the computer */
|
|
|
uint64_t freespace = 0;
|
|
|
int res = -1;
|
|
|
-#ifdef WIN32
|
|
|
+#ifdef _WIN32
|
|
|
if (GetDiskFreeSpaceEx(backup_directory, (PULARGE_INTEGER)&freespace, NULL, NULL)) {
|
|
|
res = 0;
|
|
|
}
|