Try to use fcntl to create sparse files in Darwin.

This commit is contained in:
2021-03-30 04:10:37 +01:00
parent f6f02d70ff
commit 1d53783253
4 changed files with 163 additions and 4 deletions

View File

@@ -23,11 +23,11 @@ Copyright (C) 2011-2021 Natalia Portillo
*****************************************************************************/
#if defined(__linux__) || defined(__LINUX__) || defined(__gnu_linux)
#define _GNU_SOURCE
#include <dlfcn.h>
#include "../linux/linux.h"
#elif defined(__APPLE__) && defined(__MACH__)
#include "../darwin/darwin.h"
#endif
#include <errno.h>
@@ -57,6 +57,13 @@ void Sparse(const char* path)
return;
}
#elif defined(__APPLE__) && defined(__MACH__)
ret = DarwinSparse(path);
if(ret > 0) return;
ret = chdir(path);
rmdir("SPARSE");
#endif
ret = chdir(path);