int open_tmp_file(conf_t *cnf, char *fname) { int fd = -1; gen_tmp_file(cnf, fname); fd = open(fname, O_CREAT | O_EXCL | O_RDWR | O_DIRECT, 0644); if (fd == -1) { ERROR("open %s, errno=%d", fname, errno); } return fd; }
int main() { gen_tmp_file("lock.dat"); test(); }