ACK: [PATCH 6/6] pipeio: Add fwts_pipe_close2 to cleanup from fwts_open_pipe_rw.

Alex Hung alex.hung at canonical.com
Wed Apr 27 04:32:10 UTC 2016


On 2016-04-22 01:41 PM, Jeremy Kerr wrote:
> We need a new function to cleanup after fwts_open_pipe_rw, so add a
> variant of fwts_pipe_close that accepts an additional file descriptor.
>
> Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
> ---
>   src/lib/include/fwts_pipeio.h | 1 +
>   src/lib/src/fwts_pipeio.c     | 6 ++++++
>   2 files changed, 7 insertions(+)
>
> diff --git a/src/lib/include/fwts_pipeio.h b/src/lib/include/fwts_pipeio.h
> index 7f9aaf4..9a874dd 100644
> --- a/src/lib/include/fwts_pipeio.h
> +++ b/src/lib/include/fwts_pipeio.h
> @@ -38,6 +38,7 @@ int   fwts_pipe_readwrite(
>   		const int in_fd, const char *in_buf, const size_t in_len,
>   		const int out_fd, char **out_buf, ssize_t *out_len);
>   int   fwts_pipe_close(const int fd, const pid_t pid);
> +int   fwts_pipe_close2(const int in_fd, const int out_fd, const pid_t pid);
>   int   fwts_pipe_exec(const char *command, fwts_list **list, int *status);
>   int   fwts_exec(const char *command, int *status);
>   int   fwts_write_string_to_file(const fwts_framework *fw, FILE *file, const char *str);
> diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
> index a741477..368347c 100644
> --- a/src/lib/src/fwts_pipeio.c
> +++ b/src/lib/src/fwts_pipeio.c
> @@ -259,6 +259,12 @@ int fwts_pipe_close(const int fd, const pid_t pid)
>   	}
>   }
>
> +int fwts_pipe_close2(const int in_fd, const int out_fd, const pid_t pid)
> +{
> +	close(out_fd);
> +	return fwts_pipe_close(in_fd, pid);
> +}
> +
>   /*
>    *  fwts_pipe_exec()
>    *	execute a command, return a list containing lines
>


Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list