summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tar.h8
-rw-r--r--include/util.h9
-rw-r--r--lib/tar/Makemodule.am1
-rw-r--r--lib/tar/padd_file.c4
-rw-r--r--lib/tar/write_header.c6
-rw-r--r--lib/tar/write_retry.c (renamed from lib/util/write_data.c)6
-rw-r--r--lib/util/Makemodule.am2
-rw-r--r--tar/sqfs2tar.c4
8 files changed, 20 insertions, 20 deletions
diff --git a/include/tar.h b/include/tar.h
index 319f035..f71757e 100644
--- a/include/tar.h
+++ b/include/tar.h
@@ -147,4 +147,12 @@ int padd_file(int outfd, sqfs_u64 size);
*/
int read_retry(const char *errstr, int fd, void *buffer, size_t size);
+/*
+ A wrapper around the write() system call. It retries the write if it is
+ interrupted by a signal or only part of the data was written. Returns 0
+ 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);
+
#endif /* TAR_H */
diff --git a/include/util.h b/include/util.h
index 323bedd..881b59c 100644
--- a/include/util.h
+++ b/include/util.h
@@ -41,15 +41,6 @@
#endif
/*
- A wrapper around the write() system call. It retries the write if it is
- interrupted by a signal or only part of the data was written. Returns 0
- on success. Writes to stderr on failure using 'errstr' as a perror style
- error prefix.
-*/
-SQFS_INTERNAL
-int write_data(const char *errstr, int fd, const void *data, size_t size);
-
-/*
Helper for allocating data structures with flexible array members.
'base_size' is the size of the struct itself, 'item_size' the size of a
diff --git a/lib/tar/Makemodule.am b/lib/tar/Makemodule.am
index f0945ff..abc0209 100644
--- a/lib/tar/Makemodule.am
+++ b/lib/tar/Makemodule.am
@@ -3,6 +3,7 @@ libtar_a_SOURCES += lib/tar/number.c lib/tar/checksum.c lib/tar/cleanup.c
libtar_a_SOURCES += lib/tar/read_sparse_map.c lib/tar/read_sparse_map_old.c
libtar_a_SOURCES += lib/tar/base64.c lib/tar/urldecode.c lib/tar/internal.h
libtar_a_SOURCES += lib/tar/padd_file.c lib/tar/read_retry.c include/tar.h
+libtar_a_SOURCES += lib/tar/write_retry.c
libtar_a_CFLAGS = $(AM_CFLAGS)
libtar_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/lib/tar/padd_file.c b/lib/tar/padd_file.c
index 471370d..f58cfbf 100644
--- a/lib/tar/padd_file.c
+++ b/lib/tar/padd_file.c
@@ -25,8 +25,8 @@ int padd_file(int outfd, sqfs_u64 size)
if (buffer == NULL)
goto fail_errno;
- if (write_data("padding output file to block size",
- outfd, buffer, padd_sz)) {
+ if (write_retry("padding output file to block size",
+ outfd, buffer, padd_sz)) {
goto out;
}
diff --git a/lib/tar/write_header.c b/lib/tar/write_header.c
index 14802c0..84aa2d3 100644
--- a/lib/tar/write_header.c
+++ b/lib/tar/write_header.c
@@ -88,7 +88,7 @@ static int write_header(int fd, const struct stat *sb, const char *name,
update_checksum(&hdr);
- return write_data("writing tar header record", fd, &hdr, sizeof(hdr));
+ return write_retry("writing tar header record", fd, &hdr, sizeof(hdr));
}
static int write_gnu_header(int fd, const struct stat *orig,
@@ -104,8 +104,8 @@ static int write_gnu_header(int fd, const struct stat *orig,
if (write_header(fd, &sb, name, NULL, type))
return -1;
- if (write_data("writing GNU extension header",
- fd, payload, payload_len)) {
+ if (write_retry("writing GNU extension header",
+ fd, payload, payload_len)) {
return -1;
}
diff --git a/lib/util/write_data.c b/lib/tar/write_retry.c
index 8b4c00d..1ff1a7e 100644
--- a/lib/util/write_data.c
+++ b/lib/tar/write_retry.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
- * write_data.c
+ * write_retry.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
@@ -10,9 +10,9 @@
#include <errno.h>
#include <stdio.h>
-#include "util.h"
+#include "tar.h"
-int write_data(const char *errstr, int fd, const void *data, size_t size)
+int write_retry(const char *errstr, int fd, const void *data, size_t size)
{
ssize_t ret;
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index 8dce70c..77f6c05 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -1,4 +1,4 @@
-libutil_la_SOURCES = lib/util/write_data.c include/util.h include/compat.h
+libutil_la_SOURCES = include/util.h include/compat.h
libutil_la_SOURCES += lib/util/str_table.c include/str_table.h
libutil_la_SOURCES += lib/util/alloc.c lib/util/canonicalize_name.c
libutil_la_CFLAGS = $(AM_CFLAGS)
diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c
index aaef0f7..ec1deac 100644
--- a/tar/sqfs2tar.c
+++ b/tar/sqfs2tar.c
@@ -175,8 +175,8 @@ static int terminate_archive(void)
memset(buffer, '\0', sizeof(buffer));
- return write_data("adding archive terminator", STDOUT_FILENO,
- buffer, sizeof(buffer));
+ return write_retry("adding archive terminator", STDOUT_FILENO,
+ buffer, sizeof(buffer));
}
static int get_xattrs(const char *name, const sqfs_inode_generic_t *inode,