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 1144241B86; Tue, 31 Jan 2023 03:54:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0E44410E6; Tue, 31 Jan 2023 03:54:25 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 9DD6B40EF0 for ; Tue, 31 Jan 2023 03:54:24 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id 88so12937720pjo.3 for ; Mon, 30 Jan 2023 18:54:24 -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:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=JO+V5vKc5/sba8mGpiTeKY6KIZGe/T8YIzQ6AA2QLws=; b=bJlj37BHrBotE2MHLRlENoiylGsxAbfELMebW8hNcrs0djQUgKx+vRjiUZHllj3bSp /j7S653TXGVtpKoLc5NkzumLAsuqbr2PSreT1Ur1uDml3m/oo/ZdXQl93tL/o38F+UfE WwqCzDr6nY22y6gCoioUyEX8deqEiZsNcyg1BquKndUnEkgQ0NqXNgqu1H7bZsXBvUHC 7876gyK1FCi1ACIBpzX2SoyweEyBs4p+mgzgz2hVNYsZHRUK21QvRc3KLNITuHFv2Md8 S3juhD/0fXq/D/2WuWyrp6Jmro9ikTK52dvIgYbQP+U4Y7WSqTXqa66jfWy6vuEGrqvh /kFw== 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:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JO+V5vKc5/sba8mGpiTeKY6KIZGe/T8YIzQ6AA2QLws=; b=YUYOEHORj936kCG+4cKWmG0+/Te18wo1NcPAa7G0K+5xPig0fvOU0gaBEvIxmEHvWC d/SROhanFk7RTSZ8s2jIZswa5yDuybUQEmEs79MIb2hZSUCJCzW+VxKJS+Wx3gMzM3II 4AlZEaeS9/3PCrkoNdj6Dk70Slmct+gHX4Z9u2pg+ZRHFNmRhdB0LqtA2MldzxxnO3yZ v9dPcsEckWKI/O/pOdxuFjCIVASIezY6WDFH5dha2XaqoyeZRoNhAZpkl2BQ3OiY1XP1 1gPrNrjM8AxAM4vVPJQLhEi034TKQUcdMxx5HS8388Xw4PX/EaSwkQPx5y8vwym+i4wb l9fw== X-Gm-Message-State: AFqh2kqa+B7Ybr76L4IxaA7SaMQJbaMDmJl2uHNDLmqgpwj1UcvEbB9N pCbch+AdhFh1EIiIMhEtIVyKkQ== X-Google-Smtp-Source: AMrXdXtz5jByZcM77mzPlBvpwRSLyx61OqK3L9vTW8/BmYaMo8D7RUHwzf4olovdMf0pZG7aTalKaw== X-Received: by 2002:a17:902:7614:b0:194:bcca:5e71 with SMTP id k20-20020a170902761400b00194bcca5e71mr43934699pll.68.1675133663700; Mon, 30 Jan 2023 18:54:23 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id c4-20020a170902b68400b0019644d4242dsm2275838pls.82.2023.01.30.18.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 18:54:23 -0800 (PST) Date: Mon, 30 Jan 2023 18:54:21 -0800 From: Stephen Hemminger To: Ferruh Yigit Cc: dev@dpdk.org, Olivier Matz Subject: Re: [PATCH v10 1/2] cmdline: handle EOF in cmdline_poll Message-ID: <20230130185421.462afc2d@hermes.local> In-Reply-To: References: <20221014172328.185219-1-stephen@networkplumber.org> <20230130200914.22049-1-stephen@networkplumber.org> <20230130200914.22049-2-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Mon, 30 Jan 2023 22:12:42 +0000 Ferruh Yigit wrote: > On 1/30/2023 8:09 PM, Stephen Hemminger wrote: > > 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; > > According API doc it will be wrong to return '0', which imply 'RDLINE_INIT'. The API doc is a mess. It says function returns things enum that is only defined in cmdline_private.h. Therefore no application could safely depend on it. End of File is not an error in most API's.