summaryrefslogtreecommitdiff
path: root/lib/libalpm/server.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-03-06 04:22:03 +0000
committerAaron Griffin <aaron@archlinux.org>2007-03-06 04:22:03 +0000
commit90b75a04351242c5b242359008a51c2fb0dd1d41 (patch)
treeb7ac04003c9d7f45fd6668137e11b26d16a16b74 /lib/libalpm/server.c
parent5baba8439761a54c488ff42e4e599b3c93dbe669 (diff)
downloadpacman-90b75a04351242c5b242359008a51c2fb0dd1d41.tar.xz
* Fix the double package name URL when using XferCommand
* Fixed valgrind yelling about the sprintfs in md5/sha1 routines
Diffstat (limited to 'lib/libalpm/server.c')
-rw-r--r--lib/libalpm/server.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c
index f9ff6e5d..83b38ea5 100644
--- a/lib/libalpm/server.c
+++ b/lib/libalpm/server.c
@@ -319,8 +319,10 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
char parsedCmd[PATH_MAX] = "";
char url[PATH_MAX];
char cwd[PATH_MAX];
+
/* build the full download url */
- snprintf(url, PATH_MAX, "%s://%s%s/%s", fileurl->scheme, fileurl->host, fileurl->doc, fn);
+ snprintf(url, PATH_MAX, "%s://%s%s", fileurl->scheme, fileurl->host, fileurl->doc);
+
/* replace all occurrences of %o with fn.part */
strncpy(origCmd, handle->xfercommand, sizeof(origCmd));
ptr1 = origCmd;
@@ -328,8 +330,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
usepart = 1;
ptr2[0] = '\0';
strcat(parsedCmd, ptr1);
- strcat(parsedCmd, fn);
- strcat(parsedCmd, ".part");
+ strcat(parsedCmd, output);
ptr1 = ptr2 + 2;
}
strcat(parsedCmd, ptr1);
@@ -363,10 +364,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
/* download was successful */
complete = alpm_list_add(complete, fn);
if(usepart) {
- char fnpart[PATH_MAX];
- /* rename "output.part" file to "output" file */
- snprintf(fnpart, PATH_MAX, "%s.part", fn);
- rename(fnpart, fn);
+ rename(output, realfile);
}
}
chdir(cwd);