pdump: fix error code check when creating/canceling pthread
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 29 Nov 2017 09:55:00 +0000 (10:55 +0100)
committerOlivier Matz <olivier.matz@6wind.com>
Fri, 8 Dec 2017 09:50:43 +0000 (10:50 +0100)
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

index bc18f81..44dcc95 100644 (file)
@@ -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;
        }