diff options
author | Judd Vinet <judd@archlinux.org> | 2003-03-14 18:35:57 +0100 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2003-03-14 18:35:57 +0100 |
commit | 0207fad046f76fc37c0fc7c8b6a157225024a3ed (patch) | |
tree | 56e592c62a3bf52fc2feedf1baf07e39c0c87b47 /src/pacsync.c | |
parent | f2e50be2f5b15c1985f9fcfb7ee1374dd6e94927 (diff) | |
download | pacman-0207fad046f76fc37c0fc7c8b6a157225024a3ed.tar.gz pacman-0207fad046f76fc37c0fc7c8b6a157225024a3ed.tar.xz |
Imported from pacman-2.3.1.tar.gz
Diffstat (limited to 'src/pacsync.c')
-rw-r--r-- | src/pacsync.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pacsync.c b/src/pacsync.c index a76da444..f61a61e0 100644 --- a/src/pacsync.c +++ b/src/pacsync.c @@ -104,6 +104,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) int done = 0; PMList *complete = NULL; PMList *i; + extern char* workfile; if(files == NULL) { return(0); @@ -161,6 +162,14 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) FtpOptions(FTPLIB_IDLETIME, (long)1000, control); FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control); FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control); + + /* declare our working file so it can be removed it on interrupt */ + /* by the cleanup() function */ + if(workfile) { + FREE(workfile); + } + MALLOC(workfile, PATH_MAX); + strcpy(workfile, output); if(!FtpGet(output, lp->data, FTPLIB_IMAGE, control)) { fprintf(stderr, "\nfailed downloading %s from %s: %s\n", @@ -171,6 +180,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) log_progress(control, fsz, &fsz); complete = list_add(complete, fn); } + FREE(workfile); printf("\n"); fflush(stdout); } else { @@ -211,7 +221,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files) static int log_progress(netbuf *ctl, int xfered, void *arg) { int fsz = *(int*)arg; - int pct = (unsigned int)(xfered * 100) / fsz; + int pct = ((float)xfered / fsz) * 100; int i; printf("%s [", sync_fnm); |