summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-04-21 11:15:24 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-04-21 11:15:24 +0000
commit9e70b1c9c70b4853106a03307ab352258bfd34c7 (patch)
tree352e275d4474be3f084a16f74daf001915d6dbfb /src
parent74b5e4f5350e6899bbf8e2ff6c7e4ecba17c3d9c (diff)
downloadapk-tools-9e70b1c9c70b4853106a03307ab352258bfd34c7.tar.gz
apk-tools-9e70b1c9c70b4853106a03307ab352258bfd34c7.tar.bz2
apk-tools-9e70b1c9c70b4853106a03307ab352258bfd34c7.tar.xz
apk-tools-9e70b1c9c70b4853106a03307ab352258bfd34c7.zip
url: rename to .backup rather than unlink before wget
Diffstat (limited to 'src')
-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);
}