summaryrefslogtreecommitdiffstats
path: root/src/misc/util
diff options
context:
space:
mode:
authorMohamed A. Bamakhrama <mohamed@alumni.tum.de>2020-08-03 23:19:23 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2021-11-12 12:38:55 +0100
commite792072f8a6f016eb5f2c8653f261ba7c88e6392 (patch)
tree52885f22f11545ff43fba981f024bb030fc2fb4e /src/misc/util
parente289a8059eac7d0514f8a20ffe6464fc18db1450 (diff)
downloadabc-e792072f8a6f016eb5f2c8653f261ba7c88e6392.tar.gz
abc-e792072f8a6f016eb5f2c8653f261ba7c88e6392.tar.bz2
abc-e792072f8a6f016eb5f2c8653f261ba7c88e6392.zip
Define S_IREAD|IWRITE macros using IRUSR|IWUSR
On platforms such as Android, legacy macros are no longer defined. Hence, we define them in terms of the new POSIX macros if the new ones are defined. Otherwise, we throw an error. Signed-off-by: Mohamed A. Bamakhrama <mohamed@alumni.tum.de> Signed-off-by: Miodrag Milanovic <mmicko@gmail.com>
Diffstat (limited to 'src/misc/util')
-rw-r--r--src/misc/util/utilFile.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/misc/util/utilFile.c b/src/misc/util/utilFile.c
index b6835daa..f64d71c2 100644
--- a/src/misc/util/utilFile.c
+++ b/src/misc/util/utilFile.c
@@ -25,6 +25,23 @@
#include <fcntl.h>
#include <sys/stat.h>
+// Handle legacy macros
+#if !defined(S_IREAD)
+#if defined(S_IRUSR)
+#define S_IREAD S_IRUSR
+#else
+#error S_IREAD is undefined
+#endif
+#endif
+
+#if !defined(S_IWRITE)
+#if defined(S_IWUSR)
+#define S_IWRITE S_IWUSR
+#else
+#error S_IWRITE is undefined
+#endif
+#endif
+
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <windows.h>
#include <process.h>