Fix is_file() to use S_ISREG() macro; fix is_dir() to use S_ISDIR() macro

svn path=/trunk/boinc/; revision=15063
This commit is contained in:
Charlie Fenton 2008-04-16 02:30:11 +00:00
parent 753b20a67f
commit 8a3f4dc1e5
2 changed files with 10 additions and 2 deletions

View File

@ -3263,3 +3263,11 @@ David April 15 2008
client/
hostinfo_unix.C
Charlie April 15 2008
- Fix is_file() to use S_ISREG() macro instead of incorrect
(sbuf.st_mode & S_IFREG); fix is_dir() to use S_ISDIR() macro instead of
incorrect (sbuf.st_mode & S_IFDIR).
lib/
filesys.C

View File

@ -79,13 +79,13 @@ char boinc_failed_file[256];
int is_file(const char* path) {
struct stat sbuf;
int retval = stat(path, &sbuf);
return (!retval && (sbuf.st_mode & S_IFREG));
return (!retval && S_ISREG(sbuf.st_mode));
}
int is_dir(const char* path) {
struct stat sbuf;
int retval = stat(path, &sbuf);
return (!retval && (sbuf.st_mode & S_IFDIR));
return (!retval && S_ISDIR(sbuf.st_mode));
}
#ifndef _WIN32