summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorhanlin <hanlin_wang@163.com>2019-12-30 16:25:20 +0800
committerDave Wallace <dwallacelf@gmail.com>2020-08-12 14:37:52 +0000
commit1144fb0f98ad4c7b84aad6b480933fa409c6f4c7 (patch)
tree8c8ab255d7ec4e90a48dc321fc92b9c232898179 /src/vcl
parent6104daa550b702b59ac6764efba593261d68c743 (diff)
vcl: hold errno when calling LDBG
Type: fix Call trace of LDBG: LDBG->clib_warning->_clib_error->dispatch_message->os_puts->writev However, writev will hijacked by LDP, and then execute following code: if ((errno = -ldp_init ())) return -1; Now, errno will be set. Because we always call LDBG just before return from ldp_accept4, listen, and etc. So errno will be overwritted after LDBG called. Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: I7a90f3a14772994f11f09650481411796e3f5630 (cherry picked from commit 9f3f18f99fd321cdcfc331e92b10b64f0ef590b3)
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/ldp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index e53a61e8e8c..34eba377451 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -109,7 +109,11 @@ typedef struct
#define LDBG(_lvl, _fmt, _args...) \
if (ldp->debug > _lvl) \
- clib_warning ("ldp<%d>: " _fmt, getpid(), ##_args)
+ { \
+ int errno_saved = errno; \
+ clib_warning ("ldp<%d>: " _fmt, getpid(), ##_args); \
+ errno = errno_saved; \
+ }
static ldp_main_t ldp_main = {
.vlsh_bit_val = (1 << LDP_SID_BIT_MIN),