Commit e8ab3db9 by kevinlul Committed by Edward Thomson

p_chmod: Android compatibility

Fix #5565

Pre-Android 5 did not implement a virtual filesystem atop FAT partitions for Unix permissions, which causes chmod to fail. However, Unix permissions have no effect on Android anyway as file permissions are not actually managed this way, so treating it as a no-op across all Android is safe.
parent 2ab99c6d
......@@ -62,11 +62,23 @@ GIT_INLINE(int) p_fsync(int fd)
#define p_snprintf snprintf
#define p_mkstemp(p) mkstemp(p)
#define p_chdir(p) chdir(p)
#define p_chmod(p,m) chmod(p, m)
#define p_rmdir(p) rmdir(p)
#define p_access(p,m) access(p,m)
#define p_ftruncate(fd, sz) ftruncate(fd, sz)
/*
* Pre-Android 5 did not implement a virtual filesystem atop FAT
* partitions for Unix permissions, which causes chmod to fail. However,
* Unix permissions have no effect on Android anyway as file permissions
* are not actually managed this way, so treating it as a no-op across
* all Android is safe.
*/
#ifdef __ANDROID__
# define p_chmod(p,m) 0
#else
# define p_chmod(p,m) chmod(p, m)
#endif
/* see win32/posix.h for explanation about why this exists */
#define p_lstat_posixly(p,b) lstat(p,b)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment