From patchwork Fri Jul 12 08:50:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1671 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7189C6156A for ; Fri, 12 Jul 2019 10:51:08 +0200 (CEST) Received: from neptunite.amanokami.net (softbank126209254147.bbtec.net [126.209.254.147]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D113C2B2; Fri, 12 Jul 2019 10:51:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562921468; bh=X3TwngGlrLchRNeHlMXyWIwiKGEUm+ZTb78GHL4CM38=; h=From:To:Cc:Subject:Date:From; b=Go0vw3Q/u4AagZ34Wtd/u9keUVub/GMzs5kYItACcKDjOmXsW0PoN2NBEl6FETcpn nAxde7eh1zrgFPT/iBWZArYzLuCkANl6uoOO54lTbz3US7SLvNuQt7SzGvJxZ1G1XE tV+wYIqxEh7heun74DA/fb+68LXbitCywR34gERM= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Jul 2019 17:50:57 +0900 Message-Id: <20190712085057.9240-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: process: fix error checking X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 08:51:08 -0000 The return value of a read() call is mistakenly checked for nonzero rather than less than zero. Fix this. Fixes: df23ab95f3d7 ("libcamera: process: fix compilation on Chromium OS") Signed-off-by: Paul Elder --- src/libcamera/process.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp index aee3373..6c41da2 100644 --- a/src/libcamera/process.cpp +++ b/src/libcamera/process.cpp @@ -87,7 +87,8 @@ void sigact(int signal, siginfo_t *info, void *ucontext) void ProcessManager::sighandler(EventNotifier *notifier) { char data; - if (read(pipe_[0], &data, sizeof(data))) { + ssize_t ret = read(pipe_[0], &data, sizeof(data)); + if (ret < 0) { LOG(Process, Error) << "Failed to read byte from signal handler pipe"; return;