From patchwork Mon Apr 18 22:17:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 8875881 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 27EB4BF29F for ; Mon, 18 Apr 2016 22:18:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28B9D201C0 for ; Mon, 18 Apr 2016 22:17:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B8F720165 for ; Mon, 18 Apr 2016 22:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbcDRWR5 (ORCPT ); Mon, 18 Apr 2016 18:17:57 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:42168 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126AbcDRWR4 (ORCPT ); Mon, 18 Apr 2016 18:17:56 -0400 Received: from cpc86913-craw7-2-0-cust134.16-3.cable.virginm.net ([92.239.46.135] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1asHUN-0004MR-Bg; Mon, 18 Apr 2016 22:17:51 +0000 From: Colin King To: "Rafael J . Wysocki" , Len Brown , Robert Moore , Lv Zheng , linux-acpi@vger.kernel.org, devel@acpica.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] tools/acpi: fix inverted logic when closing fd Date: Mon, 18 Apr 2016 23:17:51 +0100 Message-Id: <1461017871-5395-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King The current close on fd only occurs when fd is -ve, it should actually be closing the file if it a valid fd. Fix the inverted logic. Signed-off-by: Colin Ian King --- tools/power/acpi/tools/acpidbg/acpidbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/acpi/tools/acpidbg/acpidbg.c b/tools/power/acpi/tools/acpidbg/acpidbg.c index d070fcc..ebe44dd 100644 --- a/tools/power/acpi/tools/acpidbg/acpidbg.c +++ b/tools/power/acpi/tools/acpidbg/acpidbg.c @@ -430,7 +430,7 @@ int main(int argc, char **argv) acpi_aml_loop(fd); exit: - if (fd < 0) + if (fd >= 0) close(fd); if (acpi_aml_batch_cmd) free(acpi_aml_batch_cmd);