diff options
Diffstat (limited to 'src/pacman/package.c')
-rw-r--r-- | src/pacman/package.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/pacman/package.c b/src/pacman/package.c index 7019e7e6..06800378 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -22,8 +22,8 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <unistd.h> #include <limits.h> -#include <sys/stat.h> #include <wchar.h> #include <alpm.h> @@ -90,9 +90,6 @@ void dump_pkg_full(pmpkg_t *pkg, int level) } /* actual output */ - if(level == 0) { - string_display(_("Filename :"), alpm_pkg_get_filename(pkg)); - } string_display(_("Name :"), alpm_pkg_get_name(pkg)); string_display(_("Version :"), alpm_pkg_get_version(pkg)); string_display(_("URL :"), alpm_pkg_get_url(pkg)); @@ -179,7 +176,6 @@ 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)) { - struct stat buf; char path[PATH_MAX]; char *str = strdup(alpm_list_getdata(i)); char *ptr = index(str, '\t'); @@ -191,12 +187,12 @@ void dump_pkg_backups(pmpkg_t *pkg) ptr++; snprintf(path, PATH_MAX-1, "%s%s", root, str); /* if we find the file, calculate checksums, otherwise it is missing */ - if(!stat(path, &buf)) { + if(access(path, R_OK) == 0) { char *md5sum = alpm_get_md5sum(path); if(md5sum == NULL) { - fprintf(stderr, _("error: could not calculate checksums for %s\n"), - path); + pm_fprintf(stderr, PM_LOG_ERROR, + _("could not calculate checksums for %s\n"), path); free(str); continue; } @@ -225,17 +221,14 @@ void dump_pkg_files(pmpkg_t *pkg) { const char *pkgname, *root, *filestr; alpm_list_t *i, *pkgfiles; - char path[PATH_MAX]; pkgname = alpm_pkg_get_name(pkg); pkgfiles = alpm_pkg_get_files(pkg); root = alpm_option_get_root(); for(i = pkgfiles; i; i = alpm_list_next(i)) { - filestr = (char*)alpm_list_getdata(i); - /* build a path so we can stat the filename */ - snprintf(path, PATH_MAX-1, "%s%s", root, filestr); - fprintf(stdout, "%s %s\n", pkgname, path); + filestr = alpm_list_getdata(i); + fprintf(stdout, "%s %s%s\n", pkgname, root, filestr); } fflush(stdout); @@ -248,8 +241,7 @@ void dump_pkg_changelog(pmpkg_t *pkg) void *fp = NULL; if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, _("no changelog available for '%s'.\n"), alpm_pkg_get_name(pkg)); return; } else { |