diff --git a/checkin_notes b/checkin_notes index f7acf3a4bc..084b1aa2a5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7050,3 +7050,11 @@ David 26 Nov 2012 html/ops/ revalidate.php + +David 27 Nov 2012 + - server programs: allow config.xml to be a symlink + + lib/ + filesys.cpp,h + sched/ + sched_config.cpp diff --git a/lib/filesys.cpp b/lib/filesys.cpp index 5a4aa8c483..84b4767011 100644 --- a/lib/filesys.cpp +++ b/lib/filesys.cpp @@ -106,13 +106,20 @@ int is_dir(const char* path) { return (!retval && (((sbuf.st_mode) & S_IFMT) == S_IFDIR)); } +#ifndef _WIN32 + +int is_file_follow_symlinks(const char* path) { + struct stat sbuf; + int retval = stat(path, &sbuf); + return (!retval && (((sbuf.st_mode) & S_IFMT) == S_IFREG)); +} + int is_dir_follow_symlinks(const char* path) { struct stat sbuf; int retval = stat(path, &sbuf); return (!retval && (((sbuf.st_mode) & S_IFMT) == S_IFDIR)); } -#ifndef _WIN32 int is_symlink(const char* path) { struct stat sbuf; int retval = lstat(path, &sbuf); diff --git a/lib/filesys.h b/lib/filesys.h index 86e22d8395..1dcd27ed2d 100644 --- a/lib/filesys.h +++ b/lib/filesys.h @@ -59,6 +59,7 @@ extern "C" { extern char boinc_failed_file[MAXPATHLEN]; extern int is_file(const char* path); extern int is_dir(const char* path); + extern int is_file_follow_symlinks(const char* path); extern int is_dir_follow_symlinks(const char* path); extern int is_symlink(const char* path); extern int boinc_truncate(const char*, double); diff --git a/sched/sched_config.cpp b/sched/sched_config.cpp index 2c54bdbb21..6b08bab8c1 100644 --- a/sched/sched_config.cpp +++ b/sched/sched_config.cpp @@ -369,7 +369,7 @@ int SCHED_CONFIG::download_path(const char* filename, char* path) { static bool is_project_dir(const char* dir) { char buf[1024]; sprintf(buf, "%s/%s", dir, CONFIG_FILE); - if (!is_file(buf)) return false; + if (!is_file_follow_symlinks(buf)) return false; sprintf(buf, "%s/cgi-bin", dir); if (!is_dir_follow_symlinks(buf)) return false; return true;