[dpdk-dev] pdump: fix error code check when creating/canceling pthread

Message ID 20171208102013.1930-1-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Olivier Matz Dec. 8, 2017, 10:20 a.m. UTC
  On error, pthread_create() returns a positive number (an errno)
but does not set the errno variable.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_pdump/rte_pdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

John McNamara Jan. 16, 2018, 4:02 p.m. UTC | #1
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Olivier Matz
> Sent: Friday, December 8, 2017 10:20 AM
> To: dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>
> Cc: stable@dpdk.org
> Subject: [dpdk-stable] [PATCH] pdump: fix error code check when
> creating/canceling pthread
> 
> On error, pthread_create() returns a positive number (an errno) but does
> not set the errno variable.
> 
> Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Acked-by: John McNamara <john.mcnamara@intel.com>
  
Thomas Monjalon Jan. 17, 2018, 1:58 p.m. UTC | #2
> > On error, pthread_create() returns a positive number (an errno) but does
> > not set the errno variable.
> > 
> > Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index bc18f814a..44dcc9531 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -581,7 +581,7 @@  rte_pdump_init(const char *path)
 	if (ret != 0) {
 		RTE_LOG(ERR, PDUMP,
 			"Failed to create the pdump thread:%s, %s:%d\n",
-			strerror(errno), __func__, __LINE__);
+			strerror(ret), __func__, __LINE__);
 		return -1;
 	}
 	/* Set thread_name for aid in debugging. */
@@ -604,7 +604,7 @@  rte_pdump_uninit(void)
 	if (ret != 0) {
 		RTE_LOG(ERR, PDUMP,
 			"Failed to cancel the pdump thread:%s, %s:%d\n",
-			strerror(errno), __func__, __LINE__);
+			strerror(ret), __func__, __LINE__);
 		return -1;
 	}