summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorMichael Straube <straubem@gmx.de>2017-03-25 21:36:50 +0100
committerAllan McRae <allan@archlinux.org>2017-04-04 03:54:36 +0200
commit5678298f7dc8e0d4394e477a1a64d734e65a3ef0 (patch)
tree247b0b343b33ea81dd7e3b58690ee71823758641 /lib/libalpm/trans.c
parentc635f185ba86967cd8de9c31890b57e558f65e9b (diff)
downloadpacman-5678298f7dc8e0d4394e477a1a64d734e65a3ef0.tar.gz
pacman-5678298f7dc8e0d4394e477a1a64d734e65a3ef0.tar.xz
Ignore comments in INSTALL files (FS#51916)
If a comment in an INSTALL file contains the name of a valid INSTALL file function but the function itself is not present, pacman tries to execute that function. That leads to an error. Ignore comments in the grep function in libalpm/trans.c to avoid such errors. Signed-off-by: Michael Straube <straubem@gmx.de> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 60114882..7689079b 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -305,6 +305,7 @@ void _alpm_trans_free(alpm_trans_t *trans)
static int grep(const char *fn, const char *needle)
{
FILE *fp;
+ char *ptr;
if((fp = fopen(fn, "r")) == NULL) {
return 0;
@@ -314,6 +315,9 @@ static int grep(const char *fn, const char *needle)
if(safe_fgets(line, sizeof(line), fp) == NULL) {
continue;
}
+ if((ptr = strchr(line, '#')) != NULL) {
+ *ptr = '\0';
+ }
/* TODO: this will not work if the search string
* ends up being split across line reads */
if(strstr(line, needle)) {