diff --git a/lib/poptALL.c b/lib/poptALL.c index 936e37aecd..d2221ad843 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -133,6 +133,10 @@ static void rpmcliAllArgCallback( poptContext con, if (rpmExpandMacros(NULL, arg, &val, 0) < 0) exit(EXIT_FAILURE); fprintf(stdout, "%s\n", val); + if (fflush(stdout) == EOF) { + perror(_("Error writing to stdout")); + exit(EXIT_FAILURE); + } free(val); } break; diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at index b5ef0631a4..072b986be9 100644 --- a/tests/rpmmacro.at +++ b/tests/rpmmacro.at @@ -967,3 +967,14 @@ xxx error: bad ]) AT_CLEANUP + +AT_SETUP([no space left on stdout]) +AT_KEYWORDS([macros]) +AT_CHECK([ +runroot rpm --eval 1 >/dev/full +], +[1], +[], +[Error writing to stdout: No space left on device +]) +AT_CLEANUP