ACK: [PATCH] lib: fwts_acpid: check fcntl return rather than assuming it works
Alex Hung
alex.hung at canonical.com
Fri May 10 01:11:53 UTC 2013
On 05/07/2013 08:40 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity CID #997312, Unchecked return value from library
>
> We should check fcntl() works rather than blindly assuming it worked
> OK. Return error value if it fails.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_acpid.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_acpid.c b/src/lib/src/fwts_acpid.c
> index 5dc1d59..494be53 100644
> --- a/src/lib/src/fwts_acpid.c
> +++ b/src/lib/src/fwts_acpid.c
> @@ -60,7 +60,10 @@ int fwts_acpi_event_open(void)
> return ret;
> }
>
> - fcntl(fd, F_SETFD, FD_CLOEXEC);
> + if ((ret = fcntl(fd, F_SETFD, FD_CLOEXEC)) < 0) {
> + close(fd);
> + return ret;
> + }
>
> return fd;
> }
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list