diff options
author | Max Kellermann <max@duempel.org> | 2015-03-05 09:43:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-03-05 10:07:07 +0100 |
commit | 830a1bd130f819adfef71c882a335e5405f3f02d (patch) | |
tree | 96d2433193654ba9a99daee129f97c1cc3da283b /src/fs/FileInfo.hxx | |
parent | 5c5ea8a2542412aa02c6ac96d7f659760657644b (diff) | |
download | mpd-830a1bd130f819adfef71c882a335e5405f3f02d.tar.gz mpd-830a1bd130f819adfef71c882a335e5405f3f02d.tar.xz mpd-830a1bd130f819adfef71c882a335e5405f3f02d.zip |
fs/File{System,Info}: fix regular file check
Don't use FILE_ATTRIBUTE_NORMAL, it's a "magic" value for something
else. To check if a file is a regular file, we need to check if it's
NOT a directory (or a device).
Diffstat (limited to 'src/fs/FileInfo.hxx')
-rw-r--r-- | src/fs/FileInfo.hxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fs/FileInfo.hxx b/src/fs/FileInfo.hxx index ad0fb4064..7b272568f 100644 --- a/src/fs/FileInfo.hxx +++ b/src/fs/FileInfo.hxx @@ -65,7 +65,8 @@ class FileInfo { public: bool IsRegular() const { #ifdef WIN32 - return data.dwFileAttributes & FILE_ATTRIBUTE_NORMAL; + return (data.dwFileAttributes & + (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) == 0; #else return S_ISREG(st.st_mode); #endif |