aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-12-20 10:01:48 -0500
committerTom Rini <trini@konsulko.com>2017-12-20 10:01:48 -0500
commit75b6ede30c110706d514a85d61c9d239984a0032 (patch)
treee86eff66bc375d6ea5adbd38ab2aa3bf800241bb
parent20f06cccf59ec5588e15917caa94227b93dc597e (diff)
utest-cam-imr-drm: Fix build failure with -Werroreel_4.99.5eel/4.99.54.99.5
utest/utest-common.c::intern_trace() was not checking the return value of write(2). Add check and propagate error return to the caller. Change-Id: I2801b4468c129fd0eb865ea39499d3081336f161 Signed-off-by: Tom Rini <trini@konsulko.com>
-rw-r--r--meta-rcar-gen3-adas/recipes-bsp/utest-apps/files/0001-utest-utest-common.c-Check-return-value-of-write.patch44
-rw-r--r--meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb1
2 files changed, 45 insertions, 0 deletions
diff --git a/meta-rcar-gen3-adas/recipes-bsp/utest-apps/files/0001-utest-utest-common.c-Check-return-value-of-write.patch b/meta-rcar-gen3-adas/recipes-bsp/utest-apps/files/0001-utest-utest-common.c-Check-return-value-of-write.patch
new file mode 100644
index 0000000..80cf032
--- /dev/null
+++ b/meta-rcar-gen3-adas/recipes-bsp/utest-apps/files/0001-utest-utest-common.c-Check-return-value-of-write.patch
@@ -0,0 +1,44 @@
+From 1fd2e6ce6a443d20e6a103261860816fa5600591 Mon Sep 17 00:00:00 2001
+From: Tom Rini <trini@konsulko.com>
+Date: Wed, 20 Dec 2017 09:58:47 -0500
+Subject: [PATCH 1/1] utest/utest-common.c: Check return value of write()
+
+Signed-off-by: Tom Rini <trini@konsulko.com>
+---
+ utest/utest-common.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/utest/utest-common.c b/utest/utest-common.c
+index 38bd4714bccc..922b4bdc40a9 100644
+--- a/utest/utest-common.c
++++ b/utest/utest-common.c
+@@ -66,7 +66,7 @@ int intern_trace(const char *format, ...)
+ struct timespec ts;
+ static char buffer[4096];
+ char *p = buffer;
+- int n = sizeof(buffer), k;
++ int n = sizeof(buffer), k, ret;
+
+ /* ...retrieve value of monotonic clock */
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+@@ -88,12 +88,15 @@ int intern_trace(const char *format, ...)
+ /* ...output string terminator */
+ (n > 0 ? *p++ = '\n' : 0);
+
+- write(intern_trace_fd, buffer, p - buffer);
++ ret = write(intern_trace_fd, buffer, p - buffer);
+
+ /* ...release tracing lock */
+ pthread_mutex_unlock(&intern_trace_mutex);
+
+- return 0;
++ if (ret != -1)
++ return 0;
++ else
++ return -1;
+ }
+
+ /* ...tracing facility initialization */
+--
+2.7.4
+
diff --git a/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb b/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb
index 48747ea..4c6be5b 100644
--- a/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb
+++ b/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb
@@ -7,6 +7,7 @@ S = "${WORKDIR}/utest-cam-imr-drm"
SRC_URI = " \
file://utest-cam-imr-drm.tar.gz \
+ file://0001-utest-utest-common.c-Check-return-value-of-write.patch \
"
DEPENDS = " \