index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aurelien Foret <aurelien@archlinux.org> | 2006-02-05 09:58:16 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-02-05 09:58:16 +0000 |
commit | b708e448ea3ab31cbdc67afbb086b1900452d66a (patch) | |
tree | 8e06128881a35a840f87c56ff4b29816feb8152c | |
parent | 298c1a8e9770de435c5fc8d50c6286e9b9279da8 (diff) |
-rw-r--r-- | src/pacman/sync.c | 29 |
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index c46cf7b3..3eb85d8b 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -725,30 +725,15 @@ int pacman_sync(list_t *targets) for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) { PM_SYNCPKG *sync = alpm_list_getdata(lp); PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG); - char str[PATH_MAX], pkgname[PATH_MAX]; - char *md5sum1, *md5sum2; - - snprintf(pkgname, PATH_MAX, "%s-%s" PM_EXT_PKG, - (char *)alpm_pkg_getinfo(spkg, PM_PKG_NAME), - (char *)alpm_pkg_getinfo(spkg, PM_PKG_VERSION)); - md5sum1 = alpm_pkg_getinfo(spkg, PM_PKG_MD5SUM); - if(md5sum1 == NULL) { - ERR(NL, "can't get md5 checksum for package %s\n", pkgname); - retval = 1; - continue; - } - snprintf(str, PATH_MAX, "%s/%s", ldir, pkgname); - md5sum2 = alpm_get_md5sum(str); - if(md5sum2 == NULL) { - ERR(NL, "can't get md5 checksum for package %s\n", pkgname); - retval = 1; - continue; - } - if(strcmp(md5sum1, md5sum2) != 0) { + if(alpm_pkg_checkmd5sum(spkg) == -1) { + if(pm_errno == PM_ERR_PKG_INVALID) { + ERR(NL, "archive %s is corrupted\n", alpm_pkg_getinfo(spkg, PM_PKG_NAME)); + } else { + ERR(NL, "could not get checksum for package %s (%s)\n", + alpm_pkg_getinfo(spkg, PM_PKG_NAME), alpm_strerror(pm_errno)); + } retval = 1; - ERR(NL, "archive %s is corrupted\n", pkgname); } - FREE(md5sum2); } if(retval) { goto cleanup; |