int subst_file_open()

in flood_subst_file.c [71:93]


int subst_file_open(apr_file_t** subst_file, const char* fname,
                    apr_off_t* fsize, apr_pool_t* pool) {
  apr_finfo_t finfo;
  apr_status_t rc = 0;
  apr_int32_t wanted = APR_FINFO_SIZE;

  rc = apr_file_open(subst_file, fname, APR_READ, APR_OS_DEFAULT, pool);

  if (rc) {
    subst_file_err("Couldn't open file", fname, rc);
    exit(-1);
  }

  rc = 0;
  if (rc = apr_stat(&finfo, fname, wanted, pool)) {
    subst_file_err("stat failed on file ", fname, rc);
    apr_file_close(*subst_file);
    exit(-1);
  }
  *fsize = finfo.size;

  return 0;
}