blob: aaed713f650f6eb683cc158ae2706c9fd821d975 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef ATLAS_FOPEN_H
#define ATLAS_FOPEN_H
static int FileExists(const char *path)
{
FILE *fp;
int iret=0;
fp = fopen(path, "r");
if (fp)
{
fclose(fp);
iret = 1;
}
return(iret);
}
#ifdef ATL_FOPENDELAY
static FILE *ATL_fopen(const char *path, const char *mode)
/*
* Overload fopen so it waits for NFS propogation upon first read failure
*/
{
FILE *fp;
char ln[256];
fp = fopen(path, mode);
if (fp == NULL)
{
if (*mode == 'r') /* give NFS time to produce file */
{
sprintf(ln, "make waitfile waitfile=%s\n", path);
if (system(ln) == 0) fp = fopen(path, mode);
}
}
return(fp);
}
#define fopen ATL_fopen
#endif
#endif
|