index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2009-11-11 23:39:26 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-11-15 19:47:30 -0600 |
commit | d2dbb04a9af7a18da217fb21b9152626c43461da (patch) | |
tree | d0d3f7f1d19ce5e14031ecfcd32924036215224a /src | |
parent | be266b43647ef57632d7bcfd07a4441f737b5aed (diff) |
-rw-r--r-- | src/pacman/pacman.c | 11 |
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 574a4a8a..ff6ef5c9 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -34,6 +34,7 @@ #include <signal.h> #include <unistd.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/utsname.h> /* uname */ #include <locale.h> /* setlocale */ #include <time.h> /* time_t */ @@ -633,10 +634,11 @@ static char *get_tempfile(const char *path, const char *filename) { /** External fetch callback */ int download_with_xfercommand(const char *url, const char *localpath, - time_t mtimeold, time_t *mtimenew) { + int force) { int ret = 0; int retval; int usepart = 0; + struct stat st; char *parsedcmd,*tempcmd; char cwd[PATH_MAX]; char *destfile, *tempfile, *filename; @@ -652,6 +654,13 @@ int download_with_xfercommand(const char *url, const char *localpath, destfile = get_destfile(localpath, filename); tempfile = get_tempfile(localpath, filename); + if(force && stat(tempfile, &st) == 0) { + unlink(tempfile); + } + if(force && stat(destfile, &st) == 0) { + unlink(destfile); + } + tempcmd = strdup(config->xfercommand); /* replace all occurrences of %o with fn.part */ if(strstr(tempcmd, "%o")) { |