aboutsummaryrefslogtreecommitdiff
path: root/tests/tar_sparse_gnu2.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tar_sparse_gnu2.c')
-rw-r--r--tests/tar_sparse_gnu2.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/tar_sparse_gnu2.c b/tests/tar_sparse_gnu2.c
index 2171850..6402c87 100644
--- a/tests/tar_sparse_gnu2.c
+++ b/tests/tar_sparse_gnu2.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 = open(path, O_RDONLY);
- 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-1.tar");
- assert(read_header(fd, &hdr) == 0);
+ fp = open_read("sparse-files/pax-gnu0-1.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,10 +101,10 @@ int main(void)
assert(sparse == NULL);
clear_header(&hdr);
- close(fd);
+ fclose(fp);
- fd = open_read("sparse-files/pax-gnu1-0.tar");
- assert(read_header(fd, &hdr) == 0);
+ fp = open_read("sparse-files/pax-gnu1-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);
@@ -163,7 +163,7 @@ int main(void)
assert(sparse == NULL);
clear_header(&hdr);
- close(fd);
+ fclose(fp);
return EXIT_SUCCESS;
}