Commit 557d360c authored by Timo Teräs's avatar Timo Teräs

url: remove unused apk_url_download

parent 9d100378
......@@ -129,7 +129,6 @@ typedef int apk_dir_file_cb(void *ctx, int dirfd, const char *entry);
int apk_dir_foreach_file(int dirfd, apk_dir_file_cb cb, void *ctx);
int apk_move_file(int atfd, const char *from, const char *to);
int apk_url_download(const char *url, int atfd, const char *file);
const char *apk_url_local_file(const char *url);
void apk_id_cache_init(struct apk_id_cache *idc, int root_fd);
......
......@@ -114,36 +114,3 @@ struct apk_bstream *apk_bstream_from_fd_url(int atfd, const char *url)
fd = fork_wget(url, &pid);
return apk_bstream_from_fd_pid(fd, pid, translate_wget);
}
int apk_url_download(const char *url, int atfd, const char *file)
{
pid_t pid;
int status, fd;
fd = openat(atfd, file, O_CREAT|O_RDWR|O_TRUNC, 0644);
if (fd < 0)
return -errno;
pid = fork();
if (pid == -1)
return -1;
if (pid == 0) {
setsid();
dup2(open("/dev/null", O_RDONLY), STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
execlp("wget", "wget", "-q", "-O", "-", url, NULL);
exit(0);
}
close(fd);
waitpid(pid, &status, 0);
status = translate_wget(status);
if (status != 0) {
unlinkat(atfd, file, 0);
return status;
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment