Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=c047eca80ccf1b39f83851dbe877f8f1a70c7fd9

commit c047eca80ccf1b39f83851dbe877f8f1a70c7fd9
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Wed Apr 9 02:38:56 2008 +0200

log_progress() return 0 if there is an interrupt during the download

diff --git a/src/pacman-g2/conf.h b/src/pacman-g2/conf.h
index f4f8d0e..0fe58aa 100644
--- a/src/pacman-g2/conf.h
+++ b/src/pacman-g2/conf.h
@@ -59,6 +59,7 @@ typedef struct __config_t {
unsigned short noask;
unsigned int ask;
unsigned short regex;
+       unsigned short dl_interrupted;
} config_t;

#define FREECONF(p) do { if(p) { config_free(p); p = NULL; } } while(0)
diff --git a/src/pacman-g2/download.c b/src/pacman-g2/download.c
index 703e579..d77bf55 100644
--- a/src/pacman-g2/download.c
+++ b/src/pacman-g2/download.c
@@ -69,6 +69,9 @@ int log_progress(PM_NETBUF *ctl, int xfered, void *arg)
unsigned int maxpkglen;
static char prev_fnm[DLFNM_PROGRESS_LEN+1]="";

+       if(config->dl_interrupted)
+               return 0;
+
/* we don't need that parameter */
ctl=NULL;

diff --git a/src/pacman-g2/pacman-g2.c b/src/pacman-g2/pacman-g2.c
index 0fa236d..585c4a3 100644
--- a/src/pacman-g2/pacman-g2.c
+++ b/src/pacman-g2/pacman-g2.c
@@ -191,8 +191,10 @@ static void cleanup(int signum)
fprintf(stderr, "Internal pacman-g2 error: Segmentation fault\n"
"Please submit a full bug report, with the given package if appropriate.\n");
exit(signum);
-       } else if((signum == SIGINT) && (pacman_trans_release() == -1) && 
(pm_errno ==
-                               PM_ERR_TRANS_COMMITING)) {
+       } else if((signum == SIGINT) && (pacman_trans_release() == -1) &&
+                       ((pm_errno == PM_ERR_TRANS_COMMITING) || (pm_errno == 
PM_ERR_TRANS_DOWNLOADING))) {
+               if(pm_errno == PM_ERR_TRANS_DOWNLOADING)
+                       config->dl_interrupted = 1;
return;
}
if(signum != 0 && config->op_d_vertest == 0) {
diff --git a/src/pacman-g2/sync.c b/src/pacman-g2/sync.c
index 7e5dd19..30455b8 100644
--- a/src/pacman-g2/sync.c
+++ b/src/pacman-g2/sync.c
@@ -609,18 +609,17 @@ int syncpkg(list_t *targets)
}
}
pacman_list_free(data);
-                               MSG(NL, _("\nerrors occurred, no packages were 
upgraded.\n"));
break;
case PM_ERR_PKG_CORRUPTED:
for(lp = pacman_list_first(data); lp; lp = pacman_list_next(lp)) {
MSG(NL, "%s", (char*)pacman_list_getdata(lp));
}
pacman_list_free(data);
-                               MSG(NL, _("\nerrors occurred, no packages were 
upgraded.\n"));
break;
default:
break;
}
+               MSG(NL, _("\nerrors occurred, no packages were upgraded.\n"));
retval = 1;
goto cleanup;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to