[pacman-dev] [PATCH] run_chroot: always clear script output buffer
Andrew Gregory
andrew.gregory.8 at gmail.com
Sat Nov 28 18:20:35 UTC 2015
If the script output does not end in a newline there could still be data
in the buffer after the poll loop.
Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
lib/libalpm/util.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 5696a45..7e8f85e 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -681,6 +681,12 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
STOP_POLLING(parent2child);
}
}
+ /* process anything left in the input buffer */
+ if(ilen) {
+ /* buffer would have already been flushed if it had a newline */
+ strcpy(ibuf + ilen, "\n");
+ _alpm_chroot_process_output(handle, ibuf);
+ }
#undef STOP_POLLING
--
2.6.2
More information about the pacman-dev
mailing list