diff --git a/libc/include/bits/modes.h b/libc/include/bits/modes.h index 29c5520d..4dacc697 100644 --- a/libc/include/bits/modes.h +++ b/libc/include/bits/modes.h @@ -8,9 +8,11 @@ #define S_IFDIR 040000 #define S_IFCHR 050000 -#define S_ISREG(mode) ((mode)&S_IFMT == S_IFREG) -#define S_ISDIR(mode) ((mode)&S_IFMT == S_IFDIR) -#define S_ISCHR(mode) ((mode)&S_IFMT == S_IFCHR) +#define __CHECK_TYPE(mode, type) (((mode)&S_IFMT) == type) + +#define S_ISREG(mode) __CHECK_TYPE(mode, S_IFREG) +#define S_ISDIR(mode) __CHECK_TYPE(mode, S_IFDIR) +#define S_ISCHR(mode) __CHECK_TYPE(mode, S_IFCHR) #define S_IRWXU 0700 #define S_IRUSR 0400