From 8a3f4dc1e5ca5849762ded749f3bbc2e8496a6b6 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 16 Apr 2008 02:30:11 +0000 Subject: [PATCH] Fix is_file() to use S_ISREG() macro; fix is_dir() to use S_ISDIR() macro svn path=/trunk/boinc/; revision=15063 --- checkin_notes | 8 ++++++++ lib/filesys.C | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index fa517c89ca..b9dbdd985c 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/lib/filesys.C b/lib/filesys.C index af55b2f5fc..2893c27083 100644 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -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