From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43B2941B83; Mon, 30 Jan 2023 21:09:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C273740EE5; Mon, 30 Jan 2023 21:09:21 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id AFEF040DF6 for ; Mon, 30 Jan 2023 21:09:19 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id b5so5602218plz.5 for ; Mon, 30 Jan 2023 12:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F0TvJ8nJ0Fd60VAC5BMfbvVD61R5TzEkC3vXEl183Do=; b=8DTEy2SM4DtmV1KsbZ1Nyo5P+WVBCq9uXyBbkmA0R1EIfLBKCIDhqVztccdO+UCaq+ qi13RqvrI6riPAv5tBP3Lw3JyWPVLqMwNgOUEbD4pqjQXx3oN/NgxYL01EPgBBIV60Pc 76IGIxPRnIKE0H+giPmUa+pWW53Isd6ZfDSQoZ8908/QvOS36PO5FHMTE4D+kpjKtYoe fsj08Wpx5ICvghseriaFwU1rtXkSoVhaXYX6hiSI2AiNfZe6OjY8N4L+P0Ndd4q40aAO mEsHtcmdW87GZejPupsQy4QiM3WY39DujNsal14qaO8ctwy7T0BcURMRg4/Kjad+2T0v S8jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F0TvJ8nJ0Fd60VAC5BMfbvVD61R5TzEkC3vXEl183Do=; b=Ch3coMt84X66HC/AbRwuJ+wXhNV7cJjLN/OBWxLw4IeE/7We2A/KbJgOIRS33HFA9T rztnHf2GaZyb/KnHRn4DwN+6x+689muCj4/4E1BI5MZGgZnwC3X9YCXYfClVzJ8BnoQi 3NTVu5S/qL6WBYYGzSYvpQF6lMFGF8rJRdYUrvG9uXLUl6vftESdwLfoxIOTha7naOQ4 OSqmzmZVB3RKtpv2fr6OtgbCT2NOLSnzD1QPJ1p96rOEqpE02farCv9+zLwQEiTdd2gp dqo/9UmgdDON4GB1FoIJxIVGd+v6butf9v0KquPh7oS609s+0MK8nQQky1oaM/INskYf ABjA== X-Gm-Message-State: AO0yUKXMj4IlGr2K4bjkXIRll3ES8HvRGI1DHRhY5Wrajuxnd7a5OIUd VVgJPZPYuKnVx+7FY3+OOBfugMNZxTTF7WTtfbw= X-Google-Smtp-Source: AK7set89nDXmYus7EN64e7ChvIF8kF5TfiIM77vmZKOPfbVc37fAwBaaH8n/0b2GCyfsHeO2h1Y3Aw== X-Received: by 2002:a05:6a20:6993:b0:bc:13bd:89c8 with SMTP id t19-20020a056a20699300b000bc13bd89c8mr20234245pzk.42.1675109358628; Mon, 30 Jan 2023 12:09:18 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id p19-20020a637413000000b004774b5dc24dsm7024329pgc.12.2023.01.30.12.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 12:09:18 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v10 1/2] cmdline: handle EOF in cmdline_poll Date: Mon, 30 Jan 2023 12:09:13 -0800 Message-Id: <20230130200914.22049-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130200914.22049-1-stephen@networkplumber.org> References: <20221014172328.185219-1-stephen@networkplumber.org> <20230130200914.22049-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If end of file is reached on input, then cmdline_read_char() will return 0. The problem is that cmdline_poll() was not checking for this and would continue and not return the status. Fixes: 9251cd97a6be ("cmdline: add internal wrappers for character input") Signed-off-by: Stephen Hemminger --- lib/cmdline/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cmdline/cmdline.c b/lib/cmdline/cmdline.c index e1009ba4c413..de41406d61e0 100644 --- a/lib/cmdline/cmdline.c +++ b/lib/cmdline/cmdline.c @@ -194,7 +194,7 @@ cmdline_poll(struct cmdline *cl) else if (status > 0) { c = -1; read_status = cmdline_read_char(cl, &c); - if (read_status < 0) + if (read_status <= 0) return read_status; status = cmdline_in(cl, &c, 1); -- 2.39.0