about summary refs log tree commit diff
path: root/shared/nm-platform
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-02-18 18:54:58 +0100
committerMichael Biebl <biebl@debian.org>2021-02-18 18:54:58 +0100
commiteca19fa2272137cfd38135376f8cbf6d0a2f2187 (patch)
tree36d3cdb47cd2b3b367dced642667479007ffaf62 /shared/nm-platform
parent16df93361dd8829fa730e08ce96650b499a59f70 (diff)
parent3a56bce6c0ea7ba0fe269520547740783b342e0d (diff)
Update upstream source from tag 'upstream/1.30.0'
Update to upstream version '1.30.0'
with Debian dir e4e3c5986af4d47930d9e35ac7d8bc6c70bd1dd9
Diffstat (limited to 'shared/nm-platform')
-rw-r--r--shared/nm-platform/nmp-netns.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/shared/nm-platform/nmp-netns.c b/shared/nm-platform/nmp-netns.c
index c7cb617b..f97339a7 100644
--- a/shared/nm-platform/nmp-netns.c
+++ b/shared/nm-platform/nmp-netns.c
@@ -158,25 +158,26 @@ _netns_stack_get_impl(void)
     g_array_set_clear_func(s, _netns_stack_clear_cb);
     _netns_stack = s;
 
+    /* register a destructor function to cleanup the array. If we fail
+     * to do so, we will leak NMPNetns instances (and their file descriptor) when the
+     * thread exits. */
+    if (pthread_key_create(&key, (void (*)(void *)) g_array_unref) != 0)
+        _LOGE(NULL, "failure to initialize thread-local storage");
+    else if (pthread_setspecific(key, s) != 0)
+        _LOGE(NULL, "failure to set thread-local storage");
+
     /* at the bottom of the stack we must try to create a netns instance
      * that we never pop. It's the base to which we need to return. */
     netns = _netns_new(&error);
+
     if (!netns) {
-        _LOGE(NULL, "failed to create initial netns: %s", error->message);
+        _LOGD(NULL, "failed to create initial netns: %s", error->message);
         return s;
     }
 
     /* we leak this instance inside the stack. */
     _stack_push(s, netns, _CLONE_NS_ALL);
 
-    /* finally, register a destructor function to cleanup the array. If we fail
-     * to do so, we will leak NMPNetns instances (and their file descriptor) when the
-     * thread exits. */
-    if (pthread_key_create(&key, (void (*)(void *)) g_array_unref) != 0)
-        _LOGE(NULL, "failure to initialize thread-local storage");
-    else if (pthread_setspecific(key, s) != 0)
-        _LOGE(NULL, "failure to set thread-local storage");
-
     return s;
 }