From patchwork Mon Feb 26 09:48:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 19541 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DC4D9BD160 for ; Mon, 26 Feb 2024 09:49:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD6946286C; Mon, 26 Feb 2024 10:49:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="K53nUjye"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4E27A6286B for ; Mon, 26 Feb 2024 10:49:01 +0100 (CET) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0419A15C4; Mon, 26 Feb 2024 10:48:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1708940930; bh=hc3m/NVGQaCCRxmZpE2YxJwJ8sbmbrr9QnyXP4wBDzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K53nUjyelbar6yautxNwK8YuhyzVc7ImXeuOCpJKY5UZMCk8fpZXCB7J3uhFlm5aJ XQVT9NOyn5keG7qumXUGbRCx1xwT4LzDFVCOS9CSsriXSnKMftia4xGI/5O87+YosO Z83ADHpDI03iqd3a36ljKR+X2wMGDPZ9J2Zy7lbA= From: Kieran Bingham To: libcamera devel Subject: [PATCH 2/2] utils: ipu3: Fix return value check on file output Date: Mon, 26 Feb 2024 09:48:57 +0000 Message-Id: <20240226094857.2207313-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226094857.2207313-1-kieran.bingham@ideasonboard.com> References: <20240226094857.2207313-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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@users.noreply.github.com> Fixes: 23ac77dc4a09 ("utils: ipu3: Add IPU3 raw capture unpack utility") Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain --- 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;