summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/socket_wrapper.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 6e38f32..c5b1fdf 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -221,6 +221,7 @@ struct socket_info *sockets;
/* Function prototypes */
+bool socket_wrapper_enabled(void);
void swrap_destructor(void) DESTRUCTOR_ATTRIBUTE;
#ifdef NDEBUG
@@ -806,6 +807,13 @@ static const char *socket_wrapper_dir(void)
return s;
}
+bool socket_wrapper_enabled(void)
+{
+ const char *s = socket_wrapper_dir();
+
+ return s != NULL ? true : false;
+}
+
static unsigned int socket_wrapper_default_iface(void)
{
const char *s = getenv("SOCKET_WRAPPER_DEFAULT_IFACE");
@@ -2063,7 +2071,7 @@ static int swrap_socket(int family, int type, int protocol)
real_type &= ~SOCK_NONBLOCK;
#endif
- if (socket_wrapper_dir() == NULL) {
+ if (!socket_wrapper_enabled()) {
return libc_socket(family, type, protocol);
}