summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-02-01 11:09:13 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-02-01 11:09:13 +0200
commitd3d60512bd1df6ed5027a9dedf1d1ab97f969ad6 (patch)
tree7485f746fe2950c7550f7abde17ddc902a2ee374 /rpmio
parentfbc9b689fb7c30cabe51ec7b18bd692451249df1 (diff)
downloadrpm-d3d60512bd1df6ed5027a9dedf1d1ab97f969ad6.tar.gz
rpm-d3d60512bd1df6ed5027a9dedf1d1ab97f969ad6.tar.bz2
rpm-d3d60512bd1df6ed5027a9dedf1d1ab97f969ad6.zip
Macro shell expansion fixes (rhbz#431009)
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/macro.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 040b5a184..cef68bd42 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -497,8 +497,11 @@ doShellEscape(MacroBuf mb, const char * cmd, size_t clen)
if ((shf = popen(pcmd, "r")) == NULL)
return 1;
- while(mb->nb > 0 && (c = fgetc(shf)) != EOF)
- SAVECHAR(mb, c);
+ while((c = fgetc(shf)) != EOF) {
+ if (mb->nb > 1) {
+ SAVECHAR(mb, c);
+ }
+ }
(void) pclose(shf);
/* XXX delete trailing \r \n */