aboutsummaryrefslogtreecommitdiffstats
path: root/community/bareos/pthread-double-detach.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/bareos/pthread-double-detach.patch')
-rw-r--r--community/bareos/pthread-double-detach.patch34
1 files changed, 15 insertions, 19 deletions
diff --git a/community/bareos/pthread-double-detach.patch b/community/bareos/pthread-double-detach.patch
index e43f806bee..b0fca51e8d 100644
--- a/community/bareos/pthread-double-detach.patch
+++ b/community/bareos/pthread-double-detach.patch
@@ -1,12 +1,8 @@
-This patch fixes a double pthread_detach(), which is undefined behaviour
-and leads to a segfault when running with musl libc.
-Until this issue is fixed upstream this patch is needed.
-
---- a/src/dird/ua_server.c
-+++ b/src/dird/ua_server.c
-@@ -73,7 +73,15 @@
- UAContext *ua;
- JCR *jcr;
+--- old/core/src/dird/job.cc
++++ new/core/src/dird/job.cc
+@@ -455,7 +455,16 @@
+ {
+ JobControlRecord *jcr = (JobControlRecord *)arg;
- pthread_detach(pthread_self());
+ /* only detach if not yet detached */
@@ -18,15 +14,16 @@ Until this issue is fixed upstream this patch is needed.
+ if(_detachstate != PTHREAD_CREATE_DETACHED) {
+ pthread_detach(pthread_self());
+ }
++
+ Dsm_check(100);
- jcr = new_control_jcr("-Console-", JT_CONSOLE);
-
---- a/src/dird/job.c
-+++ b/src/dird/job.c
-@@ -420,7 +420,16 @@
+ Dmsg0(200, "=====Start Job=========\n");
+--- old/core/src/dird/ua_server.cc
++++ new/core/src/dird/ua_server.cc
+@@ -77,7 +77,15 @@
+ */
+ void *HandleUserAgentClientRequest(BareosSocket *user_agent_socket)
{
- JCR *jcr = (JCR *)arg;
-
- pthread_detach(pthread_self());
+ /* only detach if not yet detached */
+ int _detachstate;
@@ -37,7 +34,6 @@ Until this issue is fixed upstream this patch is needed.
+ if(_detachstate != PTHREAD_CREATE_DETACHED) {
+ pthread_detach(pthread_self());
+ }
-+
- Dsm_check(100);
- Dmsg0(200, "=====Start Job=========\n");
+ JobControlRecord *jcr = new_control_jcr("-Console-", JT_CONSOLE);
+