diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-02-21 09:20:56 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-02-21 09:20:56 +0000 |
commit | c485dd7d4b09a5ab99eaa3109d63376326d58355 (patch) | |
tree | 918c56f64eb92670bf2809ddf346824c91d3a8ab /libbb | |
parent | 056d02a70d8407f60ecfd4b120863114832a81af (diff) | |
download | busybox-w32-c485dd7d4b09a5ab99eaa3109d63376326d58355.tar.gz busybox-w32-c485dd7d4b09a5ab99eaa3109d63376326d58355.tar.bz2 busybox-w32-c485dd7d4b09a5ab99eaa3109d63376326d58355.zip |
Sometimes i get carried away with the use of function pointers, im sure
it seemed like a good idea at the time.
git-svn-id: svn://busybox.net/trunk/busybox@8531 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/copyfd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libbb/copyfd.c b/libbb/copyfd.c index 1ef994c98..9ab83728c 100644 --- a/libbb/copyfd.c +++ b/libbb/copyfd.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | /* If size is 0 copy until EOF */ | 36 | /* If size is 0 copy until EOF */ |
37 | extern size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size, ssize_t (*action)(int fd, const void *, size_t)) | 37 | static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size) |
38 | { | 38 | { |
39 | size_t read_total = 0; | 39 | size_t read_total = 0; |
40 | RESERVE_CONFIG_BUFFER(buffer,BUFSIZ); | 40 | RESERVE_CONFIG_BUFFER(buffer,BUFSIZ); |
@@ -50,8 +50,8 @@ extern size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size, ssize | |||
50 | } | 50 | } |
51 | 51 | ||
52 | read_actual = safe_read(src_fd, buffer, read_try); | 52 | read_actual = safe_read(src_fd, buffer, read_try); |
53 | if (read_actual > 0) { | 53 | if ((read_actual > 0) && (dst_fd >= 0)) { |
54 | if (action && (action(dst_fd, buffer, (size_t) read_actual) != read_actual)) { | 54 | if (bb_full_write(dst_fd, buffer, (size_t) read_actual) != read_actual) { |
55 | bb_perror_msg(bb_msg_write_error); /* match Read error below */ | 55 | bb_perror_msg(bb_msg_write_error); /* match Read error below */ |
56 | break; | 56 | break; |
57 | } | 57 | } |
@@ -79,12 +79,12 @@ extern size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size, ssize | |||
79 | extern int bb_copyfd_size(int fd1, int fd2, const off_t size) | 79 | extern int bb_copyfd_size(int fd1, int fd2, const off_t size) |
80 | { | 80 | { |
81 | if (size) { | 81 | if (size) { |
82 | return(bb_full_fd_action(fd1, fd2, size, bb_full_write)); | 82 | return(bb_full_fd_action(fd1, fd2, size)); |
83 | } | 83 | } |
84 | return(0); | 84 | return(0); |
85 | } | 85 | } |
86 | 86 | ||
87 | extern int bb_copyfd_eof(int fd1, int fd2) | 87 | extern int bb_copyfd_eof(int fd1, int fd2) |
88 | { | 88 | { |
89 | return(bb_full_fd_action(fd1, fd2, 0, bb_full_write)); | 89 | return(bb_full_fd_action(fd1, fd2, 0)); |
90 | } | 90 | } |