diff --git a/dcapi/condor/condor_utils.c b/dcapi/condor/condor_utils.c index 86c172ae0e..5919d07e9a 100644 --- a/dcapi/condor/condor_utils.c +++ b/dcapi/condor/condor_utils.c @@ -116,6 +116,24 @@ _DC_rm(char *name) } +int +_DC_file_exists(char *fn) +{ + return(access(fn, F_OK) == 0); +} + + +int +_DC_file_empty(char *fn) +{ + struct stat s; + + if (stat(fn, &s)) + return(1); + return(s.st_size == 0); +} + + int _DC_create_file(char *fn, char *what) { diff --git a/dcapi/condor/condor_utils.h b/dcapi/condor/condor_utils.h index e57f63d34a..461fc3a3bf 100644 --- a/dcapi/condor/condor_utils.h +++ b/dcapi/condor/condor_utils.h @@ -23,6 +23,8 @@ extern void _DC_init_utils(void); /* Usefull funcs */ extern int _DC_mkdir_with_parents(char *dn, mode_t mode); extern int _DC_rm(char *name); +extern int _DC_file_exists(char *fn); +extern int _DC_file_empty(char *fn); extern int _DC_create_file(char *fn, char *what); extern char *_DC_get_file(char *fn);