index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-16 13:15:11 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-22 12:31:12 -0500 |
commit | 54ef162a1a9e27e362732d873f0739bc0a2cf1bf (patch) | |
tree | e4ec6ba0ab94965c754a40d52a680f9fd69c4e37 /src | |
parent | 886a31ef205923fd5b29012ee75932a2e2dec4bd (diff) |
-rw-r--r-- | src/pacman/package.c | 19 |
diff --git a/src/pacman/package.c b/src/pacman/package.c index 9cdb4877..32156c53 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -151,12 +151,12 @@ void dump_pkg_full(pmpkg_t *pkg, enum pkg_from from, int extra) } static const char *get_backup_file_status(const char *root, - const char *filename, const char *expected_md5) + const pmbackup_t *backup) { char path[PATH_MAX]; const char *ret; - snprintf(path, PATH_MAX, "%s%s", root, filename); + snprintf(path, PATH_MAX, "%s%s", root, backup->name); /* if we find the file, calculate checksums, otherwise it is missing */ if(access(path, R_OK) == 0) { @@ -169,7 +169,7 @@ static const char *get_backup_file_status(const char *root, } /* if checksums don't match, file has been modified */ - if(strcmp(md5sum, expected_md5) != 0) { + if(strcmp(md5sum, backup->hash) != 0) { ret = "MODIFIED"; } else { ret = "UNMODIFIED"; @@ -200,18 +200,13 @@ void dump_pkg_backups(pmpkg_t *pkg) if(alpm_pkg_get_backup(pkg)) { /* package has backup files, so print them */ for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) { + const pmbackup_t *backup = alpm_list_getdata(i); const char *value; - char *str = strdup(alpm_list_getdata(i)); - char *ptr = strchr(str, '\t'); - if(ptr == NULL) { - free(str); + if(!backup->hash) { continue; } - *ptr = '\0'; - ptr++; - value = get_backup_file_status(root, str, ptr); - printf("%s\t%s%s\n", value, root, str); - free(str); + value = get_backup_file_status(root, backup); + printf("%s\t%s%s\n", value, root, backup->name); } } else { /* package had no backup files */ |