summaryrefslogtreecommitdiff
path: root/tests/tar_sparse_gnu1.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-06 11:54:56 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-06 11:56:02 +0100
commit4d46b361ff1371a6f3f4f89ed8ca81ee23e86de8 (patch)
tree0705d7c216ea345665cd38345bc21f8931195849 /tests/tar_sparse_gnu1.c
parent3afffc2a59cfc3888a84b2b2305b5312393ff4e8 (diff)
Remove raw file descriptors from tar read path
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/tar_sparse_gnu1.c')
-rw-r--r--tests/tar_sparse_gnu1.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/tar_sparse_gnu1.c b/tests/tar_sparse_gnu1.c
index 19106cd..a9d90d4 100644
--- a/tests/tar_sparse_gnu1.c
+++ b/tests/tar_sparse_gnu1.c
@@ -21,28 +21,28 @@
#define TEST_PATH STRVALUE(TESTPATH)
-static int open_read(const char *path)
+static FILE *open_read(const char *path)
{
- int fd = open(path, O_RDONLY);
+ FILE *fp = fopen(path, "rb");
- if (fd < 0) {
+ if (fp == NULL) {
perror(path);
exit(EXIT_FAILURE);
}
- return fd;
+ return fp;
}
int main(void)
{
tar_header_decoded_t hdr;
sparse_map_t *sparse;
- int fd;
+ FILE *fp;
assert(chdir(TEST_PATH) == 0);
- fd = open_read("sparse-files/pax-gnu0-0.tar");
- assert(read_header(fd, &hdr) == 0);
+ fp = open_read("sparse-files/pax-gnu0-0.tar");
+ assert(read_header(fp, &hdr) == 0);
assert(hdr.sb.st_mode == (S_IFREG | 0644));
assert(hdr.sb.st_uid == 01750);
assert(hdr.sb.st_gid == 01750);
@@ -101,7 +101,7 @@ int main(void)
assert(sparse == NULL);
clear_header(&hdr);
- close(fd);
+ fclose(fp);
return EXIT_SUCCESS;
}