diff --git a/test/unit/bcache_utils_t.c b/test/unit/bcache_utils_t.c index e5e66d543..9ddc19469 100644 --- a/test/unit/bcache_utils_t.c +++ b/test/unit/bcache_utils_t.c @@ -68,7 +68,7 @@ static void *_fix_init(struct io_engine *engine) T_ASSERT(f); snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX"); - f->fd = mkostemp(f->fname, O_RDWR | O_CREAT | O_EXCL); + f->fd = mkstemp(f->fname); T_ASSERT(f->fd >= 0); for (b = 0; b < NR_BLOCKS; b++) { diff --git a/test/unit/io_engine_t.c b/test/unit/io_engine_t.c index 01f659ec7..5efd4e410 100644 --- a/test/unit/io_engine_t.c +++ b/test/unit/io_engine_t.c @@ -89,13 +89,14 @@ static void *_fix_init(void) test_fail("posix_memalign failed"); snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX"); - f->fd = mkostemp(f->fname, O_RDWR | O_CREAT | O_EXCL); + f->fd = mkstemp(f->fname); T_ASSERT(f->fd >= 0); _fill_buffer(f->data, 123, SECTOR_SIZE * BLOCK_SIZE_SECTORS); - write(f->fd, f->data, SECTOR_SIZE * BLOCK_SIZE_SECTORS); - lseek(f->fd, 0, SEEK_SET); + T_ASSERT(write(f->fd, f->data, SECTOR_SIZE * BLOCK_SIZE_SECTORS) > 0); + T_ASSERT(lseek(f->fd, 0, SEEK_SET) != -1); + return f; }