mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
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 <shiningxc@gmail.com>
This commit is contained in:
parent
7a42e24400
commit
89ed15c9c2
@ -26,6 +26,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <alpm.h>
|
#include <alpm.h>
|
||||||
#include <alpm_list.h>
|
#include <alpm_list.h>
|
||||||
@ -222,14 +223,18 @@ void dump_pkg_files(pmpkg_t *pkg)
|
|||||||
filestr = (char*)alpm_list_getdata(i);
|
filestr = (char*)alpm_list_getdata(i);
|
||||||
/* build a path so we can stat the filename */
|
/* build a path so we can stat the filename */
|
||||||
snprintf(path, PATH_MAX-1, "%s%s", root, filestr);
|
snprintf(path, PATH_MAX-1, "%s%s", root, filestr);
|
||||||
if(!stat(path, &buf) && S_ISDIR(buf.st_mode)) {
|
if(!lstat(path, &buf)) {
|
||||||
/* if we stat it and it is a dir, don't print */
|
if(!S_ISDIR(buf.st_mode)) {
|
||||||
} else {
|
/* don't print directories */
|
||||||
fprintf(stdout, "%s %s\n", pkgname, path);
|
fprintf(stdout, "%s %s\n", pkgname, path);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s %s : %s\n", pkgname, path, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display the changelog of an installed package
|
/* Display the changelog of an installed package
|
||||||
|
Loading…
Reference in New Issue
Block a user