aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-16 13:20:56 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-16 13:20:56 +0000
commit3718832a1542f7bf786a1678741b8566ad3a35c6 (patch)
treeac5851de53237fb3a0c77c9cead27acd279897f0 /archival
parent1e18f1bab3400246129756a35bb5752ba98f4c90 (diff)
downloadbusybox-3718832a1542f7bf786a1678741b8566ad3a35c6.tar.gz
*: more readable handling of pipe fds. No code changes.
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/open_transformer.c16
-rw-r--r--archival/libunarchive/seek_by_jump.c2
-rw-r--r--archival/libunarchive/seek_by_read.c4
-rw-r--r--archival/tar.c8
4 files changed, 15 insertions, 15 deletions
diff --git a/archival/libunarchive/open_transformer.c b/archival/libunarchive/open_transformer.c
index d6f5e6271..3c551de06 100644
--- a/archival/libunarchive/open_transformer.c
+++ b/archival/libunarchive/open_transformer.c
@@ -15,10 +15,10 @@ int open_transformer(int src_fd,
USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd),
const char *transform_prog)
{
- int fd_pipe[2];
+ struct fd_pair fd_pipe;
int pid;
- xpipe(fd_pipe);
+ xpiped_pair(fd_pipe);
#if BB_MMU
pid = fork();
@@ -30,12 +30,12 @@ int open_transformer(int src_fd,
if (pid == 0) {
/* child process */
- close(fd_pipe[0]); /* We don't want to read from the parent */
+ close(fd_pipe.rd); /* We don't want to read from the parent */
// FIXME: error check?
#if BB_MMU
- transformer(src_fd, fd_pipe[1]);
+ transformer(src_fd, fd_pipe.wr);
if (ENABLE_FEATURE_CLEAN_UP) {
- close(fd_pipe[1]); /* Send EOF */
+ close(fd_pipe.wr); /* Send EOF */
close(src_fd);
}
exit(0);
@@ -43,7 +43,7 @@ int open_transformer(int src_fd,
{
char *argv[4];
xmove_fd(src_fd, 0);
- xmove_fd(fd_pipe[1], 1);
+ xmove_fd(fd_pipe.wr, 1);
argv[0] = (char*)transform_prog;
argv[1] = (char*)"-cf";
argv[2] = (char*)"-";
@@ -56,7 +56,7 @@ int open_transformer(int src_fd,
}
/* parent process */
- close(fd_pipe[1]); /* Don't want to write to the child */
+ close(fd_pipe.wr); /* Don't want to write to the child */
- return fd_pipe[0];
+ return fd_pipe.rd;
}
diff --git a/archival/libunarchive/seek_by_jump.c b/archival/libunarchive/seek_by_jump.c
index edbf46b21..8b5f3e887 100644
--- a/archival/libunarchive/seek_by_jump.c
+++ b/archival/libunarchive/seek_by_jump.c
@@ -6,7 +6,7 @@
#include "libbb.h"
#include "unarchive.h"
-void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
+void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount)
{
if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
#if ENABLE_FEATURE_UNARCHIVE_TAPE
diff --git a/archival/libunarchive/seek_by_read.c b/archival/libunarchive/seek_by_read.c
index 452d82d10..1f2b80571 100644
--- a/archival/libunarchive/seek_by_read.c
+++ b/archival/libunarchive/seek_by_read.c
@@ -6,10 +6,10 @@
#include "libbb.h"
#include "unarchive.h"
-/* If we are reading through a pipe(), or from stdin then we can't lseek,
+/* If we are reading through a pipe, or from stdin then we can't lseek,
* we must read and discard the data to skip over it.
*/
-void seek_by_read(const archive_handle_t *archive_handle, const unsigned int jump_size)
+void seek_by_read(const archive_handle_t *archive_handle, unsigned jump_size)
{
if (jump_size)
bb_copyfd_exact_size(archive_handle->src_fd, -1, jump_size);
diff --git a/archival/tar.c b/archival/tar.c
index a8ff7b894..4ec454b88 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -521,14 +521,14 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
volatile int vfork_exec_errno = 0;
#if WAIT_FOR_CHILD
- struct { int rd; int wr; } gzipStatusPipe;
+ struct fd_pair gzipStatusPipe;
#endif
- struct { int rd; int wr; } gzipDataPipe;
+ struct fd_pair gzipDataPipe;
const char *zip_exec = (gzip == 1) ? "gzip" : "bzip2";
- xpipe(&gzipDataPipe.rd);
+ xpiped_pair(gzipDataPipe);
#if WAIT_FOR_CHILD
- xpipe(&gzipStatusPipe.rd);
+ xpiped_pair(gzipStatusPipe);
#endif
signal(SIGPIPE, SIG_IGN); /* we only want EPIPE on errors */