current_dir = make_message("%s/rows_%u-%u", dump_dir, i, i + 999);
NOTICE_LOG("dumping rows %u - %u\n", i, i + 999);
ret = osl_mkdir(current_dir, 0777);
- if (ret < 0 && !is_errno(-ret, EEXIST))
+ if (ret < 0 && ret != -E_OSL_DIR_EXISTS)
goto out;
}
row_dir = make_message("%s/row_%03u", current_dir, i);
ret = osl_mkdir(row_dir, 0777);
- if (ret < 0 && !is_errno(-ret, EEXIST)) {
+ if (ret < 0 && ret != -E_OSL_DIR_EXISTS) {
free(row_dir);
goto out;
}
if (ret < 0)
goto out;
ret = osl_mkdir(dump_dir, 0777);
- if (ret < 0 && !is_errno(-ret, EEXIST))
+ if (ret < 0 && ret != -E_OSL_DIR_EXISTS)
goto out;
table_dump_dir = make_message("%s/%s", dump_dir, desc->name);
ret = osl_mkdir(table_dump_dir, 0777);
- if (ret < 0 && !is_errno(-ret, EEXIST))
+ if (ret < 0 && ret != -E_OSL_DIR_EXISTS)
goto out;
desc_file = make_message("%s/table_description.c", table_dump_dir);
ret = osl_open(desc_file, O_WRONLY | O_CREAT | O_EXCL, 0644);
continue;
if (!table_dir) {
ret = osl_mkdir(desc->dir, 0777);
- if (ret < 0 && !is_errno(-ret, EEXIST))
+ if (ret < 0 && ret != -E_OSL_DIR_EXISTS)
goto out;
table_dir = make_message("%s/%s", desc->dir,
desc->name);
return -E_OSL_NOMEM;
ret = osl_mkdir(dirname, 0777);
free(dirname);
- if (ret < 0 && !is_errno(-ret, EEXIST))
+ if (ret < 0 && ret != -E_OSL_DIR_EXISTS)
return ret;
return 1;
}
const char *ds_name)
{
char *dirname, *filename = disk_storage_path(t, col_num, ds_name);
- int ret, err;
+ int ret = 1;
if (!filename)
return -E_OSL_NOMEM;
- ret = unlink(filename);
- err = errno;
+ if (unlink(filename) < 0)
+ ret = errno == ENOENT? -E_OSL_NOENT : -E_OSL_UNLINK;
free(filename);
if (ret < 0)
- return -E_OSL_UNLINK;
+ return ret;
if (!(t->desc->flags & OSL_LARGE_TABLE))
return 1;
dirname = disk_storage_dirname(t, col_num, ds_name);
if (ret < 0)
return ret;
ret = delete_disk_storage_file(t, col_num, ds_name);
- if (ret < 0 && !is_errno(-ret, ENOENT)) {
+ if (ret < 0 && ret != -E_OSL_NOENT) {
free(ds_name);
return ret;
}