diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-21 11:15:24 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-21 11:15:24 +0000 |
commit | 9e70b1c9c70b4853106a03307ab352258bfd34c7 (patch) | |
tree | 352e275d4474be3f084a16f74daf001915d6dbfb /src/url.c | |
parent | 74b5e4f5350e6899bbf8e2ff6c7e4ecba17c3d9c (diff) | |
download | apk-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/url.c')
-rw-r--r-- | src/url.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); } |