[PATCH 2/2] utils: ipu3: Fix return value check on file output

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Feb 26 10:48:57 CET 2024


The data parsed by ipu3-unpack is written out using the write() c
library call, but the error code is incorrectly checked which misses the
single erroroneous return value returned by the function.

Fix it to explicitly check against the error code.

Reported-by: Johan Mattsson <39247600+mjunix at users.noreply.github.com>
Fixes: 23ac77dc4a09 ("utils: ipu3: Add IPU3 raw capture unpack utility")
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 utils/ipu3/ipu3-unpack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/ipu3/ipu3-unpack.c b/utils/ipu3/ipu3-unpack.c
index 9d2c1200d932..c96fafed2435 100644
--- a/utils/ipu3/ipu3-unpack.c
+++ b/utils/ipu3/ipu3-unpack.c
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
 		}
 
 		ret = write(out_fd, out_data, 50);
-		if (ret < -1) {
+		if (ret == -1) {
 			fprintf(stderr, "Failed to write output data: %s\n",
 				strerror(errno));
 			goto done;
-- 
2.34.1



More information about the libcamera-devel mailing list