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 */