summaryrefslogtreecommitdiff
path: root/src/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/url.c b/src/url.c
index 79f66ca..c010ea8 100644
--- a/src/url.c
+++ b/src/url.c
@@ -83,6 +83,7 @@ int apk_url_download(const char *url, const char *file)
{
pid_t pid;
int status;
+ char tmp[256];
pid = fork();
if (pid == -1)
@@ -91,7 +92,8 @@ int apk_url_download(const char *url, const char *file)
if (pid == 0) {
setsid();
dup2(open("/dev/null", O_RDONLY), STDIN_FILENO);
- unlink(file);
+ snprintf(tmp, sizeof(tmp), "%s.backup", file);
+ rename(file, tmp);
execlp("wget", "wget", "-q", "-O", file, url, NULL);
exit(0);
}