summaryrefslogtreecommitdiff
path: root/src/url.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-17 13:51:49 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-17 14:23:14 +0300
commitdbb642206d2ef73c5428a04cb10bb27e7cdd3b29 (patch)
treea1844d9b309d3d46ab14317ca5c42b9905222452 /src/url.c
parentf79e3946a40bf6beb2a38050a866c0fb1ed4bcf4 (diff)
downloadapk-tools-dbb642206d2ef73c5428a04cb10bb27e7cdd3b29.tar.gz
apk-tools-dbb642206d2ef73c5428a04cb10bb27e7cdd3b29.tar.bz2
apk-tools-dbb642206d2ef73c5428a04cb10bb27e7cdd3b29.tar.xz
apk-tools-dbb642206d2ef73c5428a04cb10bb27e7cdd3b29.zip
io: fix splice for copying unknown lengths
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/url.c b/src/url.c
index 2484a7f..c96e0a1 100644
--- a/src/url.c
+++ b/src/url.c
@@ -86,13 +86,13 @@ static int fork_wget(const char *url, pid_t *ppid)
return fds[0];
}
-struct apk_istream *apk_istream_from_url(const char *url)
+struct apk_istream *apk_istream_from_fd_url(int atfd, const char *url)
{
pid_t pid;
int fd;
- if (apk_url_local_file(url) != NULL)
- return apk_istream_from_file(AT_FDCWD, apk_url_local_file(url));
+ if (atfd >= 0 && apk_url_local_file(url) != NULL)
+ return apk_istream_from_file(atfd, apk_url_local_file(url));
fd = fork_wget(url, &pid);
return apk_istream_from_fd_pid(fd, pid, translate_wget);
@@ -103,13 +103,13 @@ struct apk_istream *apk_istream_from_url_gz(const char *file)
return apk_bstream_gunzip(apk_bstream_from_url(file));
}
-struct apk_bstream *apk_bstream_from_url(const char *url)
+struct apk_bstream *apk_bstream_from_fd_url(int atfd, const char *url)
{
pid_t pid;
int fd;
- if (apk_url_local_file(url))
- return apk_bstream_from_file(AT_FDCWD, url);
+ if (atfd >= 0 && apk_url_local_file(url))
+ return apk_bstream_from_file(atfd, url);
fd = fork_wget(url, &pid);
return apk_bstream_from_fd_pid(fd, pid, translate_wget);