diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-04-28 17:36:51 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-04-28 17:38:15 +0100 |
commit | 5dd6fa6f228f022d3e2e3e1ee7a21b3d4f17724e (patch) | |
tree | 8172aa4a03937a4fd04c3cfa20a99b12a1317bbb /utils | |
parent | 1fd565cba706d6a9e809d14f79ceb92633b62ead (diff) | |
download | netsurf-5dd6fa6f228f022d3e2e3e1ee7a21b3d4f17724e.tar.gz netsurf-5dd6fa6f228f022d3e2e3e1ee7a21b3d4f17724e.tar.bz2 |
use compatability macro for mkdir
Diffstat (limited to 'utils')
-rw-r--r-- | utils/filepath.c | 3 | ||||
-rw-r--r-- | utils/utils.h | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/utils/filepath.c b/utils/filepath.c index d82dfc627..68e8d7e79 100644 --- a/utils/filepath.c +++ b/utils/filepath.c @@ -31,6 +31,7 @@ #include <unistd.h> #include <string.h> +#include "utils/utils.h" #include "utils/config.h" #include "utils/filepath.h" @@ -378,7 +379,7 @@ nserror filepath_mkdir_all(const char *fname) while ((sep = strchr(sep, '/')) != NULL) { *sep = 0; if (stat(dname, &sb) != 0) { - if (mkdir(dname, S_IRWXU) != 0) { + if (nsmkdir(dname, S_IRWXU) != 0) { /* could not create path element */ free(dname); return NSERROR_NOT_FOUND; diff --git a/utils/utils.h b/utils/utils.h index ed19cb33f..db26ed176 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -60,10 +60,13 @@ struct dirent; #define PRId64 "lld" #endif +/* Windows does not have POSIX formating codes or mkdir so work around that */ #if defined(_WIN32) #define SSIZET_FMT "Iu" +#define nsmkdir(dir, mode) mkdir((dir)) #else #define SSIZET_FMT "zd" +#define nsmkdir(dir, mode) mkdir((dir), (mode)) #endif #if defined(__GNUC__) && (__GNUC__ < 3) @@ -105,12 +108,6 @@ typedef struct void (*cancel)(query_id, enum query_response res, void *pw); } query_callback; -#ifdef HAVE_MKDIR -#define nsmkdir(dir, mode) mkdir((dir), (mode)) -#else -#define nsmkdir(dir, mode) mkdir((dir)) -#endif - #ifndef timeradd #define timeradd(a, aa, result) \ do { \ |