[PATCH] lib: fwts_acpid: check fcntl return rather than assuming it works
Colin King
colin.king at canonical.com
Tue May 7 00:40:07 UTC 2013
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;
}
--
1.8.1.2
More information about the fwts-devel
mailing list