Macro shell expansion fixes (rhbz#431009)
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 1 Feb 2008 09:09:13 +0000 (11:09 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 1 Feb 2008 09:09:13 +0000 (11:09 +0200)
rpmio/macro.c

index 040b5a1..cef68bd 100644 (file)
@@ -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 */