From 47eb0c419687c2690292c1910acae83a46e5388c Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Sat, 13 Apr 2013 13:18:07 -0700 Subject: [PATCH] rdma_cm: Detect recursive calls to rdma_seterrno() If rdma_seterrno() is called in a recursive fashion, the result is that errno ends up set to -1. We can avoid this by only setting errno if the return value is > 0. Problem reported by hookenz@gmail.com. Signed-off-by: Sean Hefty --- include/rdma/rdma_verbs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rdma/rdma_verbs.h b/include/rdma/rdma_verbs.h index 198c6a59..8314fe7b 100644 --- a/include/rdma/rdma_verbs.h +++ b/include/rdma/rdma_verbs.h @@ -44,7 +44,7 @@ extern "C" { static inline int rdma_seterrno(int ret) { - if (ret) { + if (ret > 0) { errno = ret; ret = -1; } -- 2.41.0