- server: is_project_dir() was checking that cgi-bin is a directory.

This doesn't work if it's a symlink to a dir.
    Check for that too.


svn path=/trunk/boinc/; revision=25480
This commit is contained in:
David Anderson 2012-03-23 17:45:04 +00:00
parent adab6254bc
commit 9caa637a4d
4 changed files with 23 additions and 2 deletions

View File

@ -2964,7 +2964,11 @@ Rom 22 Mar 2012
vbox.cpp
David 22 Mar 2012
- client/server:
- client/server: add optional <dont_use_dcf/> to schedule reply.
If set, client won't use DCF for this project.
Make this the default in server code;
we now do runtime estimation entirely on the server side,
and the client-side mechanism is counterproductive.
sched/
sched_types.cpp,h
@ -2974,3 +2978,13 @@ David 22 Mar 2012
work_fetch.cpp
cs_scheduler.cpp
cpu_sched.cpp
David 23 Mar 2012
- server: is_project_dir() was checking that cgi-bin is a directory.
This doesn't work if it's a symlink to a dir.
Check for that too.
lib/
filesys.cpp,h
sched/
sched_config.cpp

View File

@ -105,6 +105,12 @@ int is_dir(const char* path) {
return (!retval && (((sbuf.st_mode) & S_IFMT) == S_IFDIR));
}
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;

View File

@ -59,6 +59,7 @@ extern "C" {
extern char boinc_failed_file[256];
extern int is_file(const char* path);
extern int is_dir(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);
extern int boinc_file_exists(const char* path);

View File

@ -377,7 +377,7 @@ static bool is_project_dir(const char* dir) {
sprintf(buf, "%s/%s", dir, CONFIG_FILE);
if (!is_file(buf)) return false;
sprintf(buf, "%s/cgi-bin", dir);
if (!is_dir(buf)) return false;
if (!is_dir_follow_symlinks(buf)) return false;
return true;
}