aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-06 10:44:26 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-06 11:10:58 +0100
commit3afffc2a59cfc3888a84b2b2305b5312393ff4e8 (patch)
tree029ac4c5f55e9e7149cd40d0f57c52efcd41608f /include
parent9f1f3f959d3411c200afb5a1df4fffa9d87df616 (diff)
Remove raw file descriptors from unpack write paths
Instead, use stdio FILE pointers. On POSIX systems, use fileno to get the file descriptor and hopefully create sparase files. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/common.h2
-rw-r--r--include/tar.h7
2 files changed, 5 insertions, 4 deletions
diff --git a/include/common.h b/include/common.h
index ba42054..da9093f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -118,7 +118,7 @@ char *sqfs_tree_node_get_path(const sqfs_tree_node_t *node);
int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
const sqfs_inode_generic_t *inode,
- int outfd, size_t block_size, bool allow_sparse);
+ FILE *fp, size_t block_size, bool allow_sparse);
sqfs_file_t *sqfs_get_stdin_file(const sparse_map_t *map, sqfs_u64 size);
diff --git a/include/tar.h b/include/tar.h
index c5d48ef..8f9f55c 100644
--- a/include/tar.h
+++ b/include/tar.h
@@ -12,6 +12,7 @@
#include <stdbool.h>
#include <stdint.h>
+#include <stdio.h>
typedef struct sparse_map_t {
struct sparse_map_t *next;
@@ -118,7 +119,7 @@ typedef struct {
The counter is an incremental record counter used if additional
headers need to be generated.
*/
-int write_tar_header(int fd, const struct stat *sb, const char *name,
+int write_tar_header(FILE *fp, const struct stat *sb, const char *name,
const char *slink_target, const tar_xattr_t *xattr,
unsigned int counter);
@@ -136,7 +137,7 @@ void clear_header(tar_header_decoded_t *hdr);
Write zero bytes to an output file to padd it to the tar record size.
Returns 0 on success. On failure, prints error message to stderr.
*/
-int padd_file(int outfd, sqfs_u64 size);
+int padd_file(FILE *fp, sqfs_u64 size);
/*
@@ -153,6 +154,6 @@ int read_retry(const char *errstr, int fd, void *buffer, size_t size);
on success. Writes to stderr on failure using 'errstr' as a perror style
error prefix.
*/
-int write_retry(const char *errstr, int fd, const void *data, size_t size);
+int write_retry(const char *errstr, FILE *fp, const void *data, size_t size);
#endif /* TAR_H */