From 54e6050f0b8f121ec75a1c651358bab783661c25 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 May 2004 23:16:19 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3407 --- api/gutil.C | 2 +- checkin_notes | 12 ++++++++++++ lib/app_ipc.C | 4 +++- lib/filesys.C | 8 ++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/api/gutil.C b/api/gutil.C index 6dc7c4f2ba..47c82921d8 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -862,7 +862,7 @@ void STARFIELD::update_stars(float dt) { mode_lines(); glColor4f(1.0, 1.0, 1.0, 1.0); for (i=0; i zmax) stars[i].z -= zmax; diff --git a/checkin_notes b/checkin_notes index c189be0319..a5e93e8bef 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12420,3 +12420,15 @@ David May 19 2004 cs_benchmark.C dhrystone.C whetstone.C + +David May 19 2004 + - boinc_fopen: if opening for read, and file doesn't exist, + return 0 immediately (avoid 5-sec delays) + - boinc_resolve_filename: use boinc_fopen() to open symlink file + - graphics: scale starfield velocity down by a factor of 10 + + api/ + gutil.C + lib/ + app_ipc.C + filesys.C diff --git a/lib/app_ipc.C b/lib/app_ipc.C index da81a0ced8..a67de5b228 100755 --- a/lib/app_ipc.C +++ b/lib/app_ipc.C @@ -28,6 +28,7 @@ #include "parse.h" #include "error_numbers.h" #include "util.h" +#include "filesys.h" #include "app_ipc.h" @@ -311,7 +312,8 @@ int boinc_resolve_filename(const char *virtual_name, char *physical_name, int le safe_strncpy(physical_name, virtual_name, len); // Open the file and load the first line - fp = fopen(virtual_name, "r"); + // + fp = boinc_fopen(virtual_name, "r"); if (!fp) return ERR_FOPEN; fgets(buf, 512, fp); diff --git a/lib/filesys.C b/lib/filesys.C index 54a7075ee5..7e733a59e4 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -340,6 +340,14 @@ int dir_size(const char* dirpath, double& size) { FILE* boinc_fopen(const char* path, const char* mode) { FILE* f; + // if opening for read, and file isn't there, + // leave now (avoid 5-second delay!!) + // + if (strchr(mode, 'r')) { + if (!boinc_file_exists(path)) { + return 0; + } + } f = fopen(path, mode); #ifdef _WIN32 // on Windows: if fopen fails, try again for 5 seconds