1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: swith to mkstemp

As mkostemp is only on newer systems, switch to more old version
which effectively does exactly the same thing for given list of
open flags.
This commit is contained in:
Zdenek Kabelac 2018-05-12 23:23:54 +02:00
parent 9640320aea
commit 0a5edc1f12
2 changed files with 5 additions and 4 deletions

View File

@ -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++) {

View File

@ -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;
}