[pacman-dev] [PATCH] Fix broken output when asking question and stdin is piped

Allan McRae allan at archlinux.org
Thu Jan 12 16:36:41 EST 2012


On 13/01/12 07:35, Allan McRae wrote:
> On 13/01/12 01:08, Olivier Brunel wrote:
>> When asking question and stdin is piped, the response does not get printed out,
>> resulting in a missing \n and broken output (FS#27909); printing the response
>> fixes it.
>>
>> Signed-off-by: Olivier Brunel <i.am.jack.mail at gmail.com>
>> ---
>>  src/pacman/util.c |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/pacman/util.c b/src/pacman/util.c
>> index 2d88bac..0da86dd 100644
>> --- a/src/pacman/util.c
>> +++ b/src/pacman/util.c
>> @@ -1429,6 +1429,12 @@ static int question(short preset, char *fmt, va_list args)
>>  		if(len == 0) {
>>  			return preset;
>>  		}
>> +		
>> +		/* if stdin is piped, response does not get printed out, and as a result
>> +		 * a \n is missing, resulting in broken output (FS#27909) */
>> +		if(!isatty(fileno(stdin))) {
> 
> Shouldn't we use STDIN_FILENO there to be nicely POSIX compliant?

Crap... started reading email from the newest...   You can ignore.



More information about the pacman-dev mailing list