From 89ed15c9c2dd5449d50e5ec2283a4d6ebac5f328 Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Mon, 2 Jul 2007 00:57:47 +0200 Subject: pacman/packages.c : print an error for files that can't be stated. The -Ql operation is supposed to print all files but directories. stat was used for detecting directories. However, when stat failed, (because the file doesn't exist or is not readable), the files were still displayed just like the others. Now, these files are printed on stderr, with the corresponding error message. Signed-off-by: Chantry Xavier --- src/pacman/package.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pacman/package.c b/src/pacman/package.c index c91384d9..a30260ae 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -222,14 +223,18 @@ void dump_pkg_files(pmpkg_t *pkg) filestr = (char*)alpm_list_getdata(i); /* build a path so we can stat the filename */ snprintf(path, PATH_MAX-1, "%s%s", root, filestr); - if(!stat(path, &buf) && S_ISDIR(buf.st_mode)) { - /* if we stat it and it is a dir, don't print */ + if(!lstat(path, &buf)) { + if(!S_ISDIR(buf.st_mode)) { + /* don't print directories */ + fprintf(stdout, "%s %s\n", pkgname, path); + } } else { - fprintf(stdout, "%s %s\n", pkgname, path); + fprintf(stderr, "%s %s : %s\n", pkgname, path, strerror(errno)); } } fflush(stdout); + fflush(stderr); } /* Display the changelog of an installed package -- cgit v1.2.3-24-g4f1b