Matthew Booth wrote:
On 19/08/09 09:34, Jim Meyering wrote:
> There were a few unchecked syscalls in fish.c
>
>> From ba8b8b0684a03b6e6fbb939ed7e1cbf5e1000092 Mon Sep 17 00:00:00 2001
> From: Jim Meyering<meyering(a)redhat.com>
> Date: Wed, 19 Aug 2009 10:01:07 +0200
> Subject: [PATCH libguestfs] guestfish: detect a few more failed syscalls
>
> * fish/fish.c (issue_command): Detect/diagnose more failed syscalls.
> ---
> fish/fish.c | 26 +++++++++++++++++++++-----
> 1 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/fish/fish.c b/fish/fish.c
> index 830617b..e6cd270 100644
> --- a/fish/fish.c
> +++ b/fish/fish.c
> @@ -750,8 +750,14 @@ issue_command (const char *cmd, char *argv[], const char
*pipecmd)
> if (pipecmd) {
> int fd[2];
>
> - fflush (stdout);
> - pipe (fd);
> + if (fflush (stdout)); {
Looks like a stray semicolon in there. Also, wouldn't it be better
form to test for test for a return value of EOF?
Argh. Thanks.
And yes, testing for EOF does seem better.
I also noticed that there are other unchecked dup2 and fflush calls.
Another round coming right up.