- server programs: allow config.xml to be a symlink

This commit is contained in:
David Anderson 2012-11-27 10:50:32 -08:00 committed by Oliver Bock
parent 3af9309894
commit 8ae9680134
4 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;