From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AAC94F72 for ; Mon, 23 Jul 2018 12:45:04 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2018 03:45:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,393,1526367600"; d="scan'208";a="77049032" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by orsmga002.jf.intel.com with ESMTP; 23 Jul 2018 03:44:26 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: bernard.iremonger@intel.com, reshma.pattan@intel.com Date: Mon, 23 Jul 2018 11:44:25 +0100 Message-Id: <20180723104425.10090-1-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2018 10:45:05 -0000 Fix testpmd app exit by pressing ctrl+d, End-of-Transmission character (EOT) on the empty command line. Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode") Reported-by: Mordechay Haimovsky Signed-off-by: Jasvinder Singh --- app/test-pmd/cmdline.c | 10 ++++++---- lib/librte_cmdline/cmdline.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5885289..edaf0e6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17581,12 +17581,14 @@ prompt(void) for (;;) { status = cmdline_poll(testpmd_cl); - if (status < 0) - rte_panic("CLI poll error (%" PRId32 ")\n", status); - else if (status == RDLINE_EXITED) { + if (status == RDLINE_EXITED || status == RDLINE_RES_EOF) { + if (status == RDLINE_RES_EOF) + pmd_test_exit(); + cmdline_stdin_exit(testpmd_cl); rte_exit(0, "\n"); - } + } else if (status < 0) + rte_panic("CLI poll error (%" PRId32 ")\n", status); #if defined RTE_LIBRTE_PMD_SOFTNIC diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index 591b78b..47b0f6a 100644 --- a/lib/librte_cmdline/cmdline.c +++ b/lib/librte_cmdline/cmdline.c @@ -187,7 +187,7 @@ cmdline_in(struct cmdline *cl, const char *buf, int size) rdline_newline(&cl->rdl, cl->prompt); } else if (ret == RDLINE_RES_EOF) - return -1; + return RDLINE_RES_EOF; else if (ret == RDLINE_RES_EXITED) return -1; } -- 2.9.3