Verified Commit 0de7d306 authored by jD91mZM2's avatar jD91mZM2
Browse files

Fix S_IS*

For some reason, C handles `==` before `&`.
So `a & b == c` is the same thing as `a & (b == c)`.
parent 028378b8
#ifndef _BITS_STAT_H
#define _BITS_STAT_H
#define S_ISDIR(mode) mode & S_IFMT == S_IFDIR
#define S_ISCHR(mode) mode & S_IFMT == S_IFCHR
#define S_ISBLK(mode) mode & S_IFMT == S_IFBLK
#define S_ISREG(mode) mode & S_IFMT == S_IFREG
#define S_ISFIFO(mode) mode & S_IFMT == S_IFIFO
#define S_ISLNK(mode) mode & S_IFMT == S_IFLNK
#define S_ISSOCK(mode) mode & S_IFMT == S_IFSOCK
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
......
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