From: Brad King Date: Wed, 11 Nov 2009 14:19:55 +0000 (-0500) Subject: Do not redefine stat and file mode macros X-Git-Tag: v2.8.0~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef5931367c0025086756eb085b0ace4912e86b51;p=thirdparty%2Flibarchive.git Do not redefine stat and file mode macros Some windows compilers define macros like O_RDONLY and S_ISBLK with leading underscores (e.g. _O_RDONLY and _S_ISBLK). In our windows compatibility header "archive_windows.h" we define the non-prefixed names so that the rest of our code can use them everywhere. However, some windows compilers also define the non-prefixed names. On these compilers we should not redefine them. SVN-Revision: 1638 --- diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h index e65be916c..17fb6f5f4 100644 --- a/libarchive/archive_windows.h +++ b/libarchive/archive_windows.h @@ -122,12 +122,14 @@ #define waitpid __la_waitpid #define write __la_write +#ifndef O_RDONLY #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY #define O_TRUNC _O_TRUNC #define O_CREAT _O_CREAT #define O_EXCL _O_EXCL #define O_BINARY _O_BINARY +#endif #ifndef _S_IFIFO #define _S_IFIFO 0010000 /* pipe */ @@ -154,20 +156,30 @@ #define _S_IFMT 0170000 /* file type mask */ #endif +#ifndef S_IFIFO #define S_IFIFO _S_IFIFO +#endif //#define S_IFCHR _S_IFCHR //#define S_IFDIR _S_IFDIR +#ifndef S_IFBLK #define S_IFBLK _S_IFBLK +#endif +#ifndef S_IFLNK #define S_IFLNK _S_IFLNK +#endif +#ifndef S_IFSOCK #define S_IFSOCK _S_IFSOCK +#endif //#define S_IFREG _S_IFREG //#define S_IFMT _S_IFMT +#ifndef S_ISBLK #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ +#endif #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */ #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */ @@ -192,10 +204,12 @@ #define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */ #define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */ +#ifndef S_IRWXU #define S_IRWXU _S_IRWXU #define S_IXUSR _S_IXUSR #define S_IWUSR _S_IWUSR #define S_IRUSR _S_IRUSR +#endif #define S_IRWXG _S_IRWXG #define S_IXGRP _S_IXGRP #define S_IWGRP _S_IWGRP