• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/uclibc/0.9.33.2/uclibc-0022-inet-rpc-fix-authnone_marshal-in-multithreading-cont.patch
Peter KorsgaardPeter Korsgaard committed 055f1c02d3506 Sep 2013
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
From 5c797a24a7d6337b5e654079a8d815199b1e8364 Mon Sep 17 00:00:00 2001
2
From: Carmelo Amoroso <carmelo.amoroso@st.com>
3
Date: Thu, 2 Feb 2012 18:22:36 +0100
4
Subject: [PATCH] inet:rpc: fix authnone_marshal in multithreading context
5
​
6
This is a port of glibc's fix by Zack Weinberg as reported
7
in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=142312,
8
and discussed in http://sourceware.org/ml/libc-alpha/2002-04/msg00069.html
9
and following.
10
​
11
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
12
---
13
 libc/inet/rpc/auth_none.c   |   59 +++++++++++++++++++++----------------------
14
 libc/inet/rpc/rpc_private.h |    2 --
15
 libc/inet/rpc/rpc_thread.c  |    1 -
16
 3 files changed, 29 insertions(+), 33 deletions(-)
17
​
18
diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c
19
index c48bbfe..d066f6b 100644
20
--- a/libc/inet/rpc/auth_none.c
21
+++ b/libc/inet/rpc/auth_none.c
22
@@ -66,49 +66,48 @@ struct authnone_private_s {
23
   char marshalled_client[MAX_MARSHAL_SIZE];
24
   u_int mcnt;
25
 };
26
-#ifdef __UCLIBC_HAS_THREADS__
27
-#define authnone_private (*(struct authnone_private_s **)&RPC_THREAD_VARIABLE(authnone_private_s))
28
-#else
29
-static struct authnone_private_s *authnone_private;
30
-#endif
31
 
32
-AUTH *
33
-authnone_create (void)
34
+static struct authnone_private_s authnone_private;
35
+__libc_once_define(static, authnone_private_guard);
36
+
37
+static void authnone_create_once (void);
38
+
39
+static void
40
+authnone_create_once (void)
41
 {
42
   struct authnone_private_s *ap;
43
   XDR xdr_stream;
44
   XDR *xdrs;
45
 
46
-  ap = (struct authnone_private_s *) authnone_private;
47
-  if (ap == NULL)
48
-    {
49
-      ap = (struct authnone_private_s *) calloc (1, sizeof (*ap));
50
-      if (ap == NULL)
51
-   return NULL;
52
-      authnone_private = ap;
53
-    }
54
-  if (!ap->mcnt)
55
-    {
56
-      ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
57
-      ap->no_client.ah_ops = (struct auth_ops *)&ops;
58
-      xdrs = &xdr_stream;
59
-      xdrmem_create (xdrs, ap->marshalled_client, (u_int) MAX_MARSHAL_SIZE,
60
-            XDR_ENCODE);
61
-      (void) xdr_opaque_auth (xdrs, &ap->no_client.ah_cred);
62
-      (void) xdr_opaque_auth (xdrs, &ap->no_client.ah_verf);
63
-      ap->mcnt = XDR_GETPOS (xdrs);
64
-      XDR_DESTROY (xdrs);
65
-    }
66
-  return (&ap->no_client);
67
+  ap = &authnone_private;
68
+
69
+  ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
70
+  ap->no_client.ah_ops = (struct auth_ops *) &ops;
71
+  xdrs = &xdr_stream;
72
+  xdrmem_create(xdrs, ap->marshalled_client,
73
+            (u_int) MAX_MARSHAL_SIZE, XDR_ENCODE);
74
+  (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
75
+  (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
76
+  ap->mcnt = XDR_GETPOS (xdrs);
77
+  XDR_DESTROY (xdrs);
78
+}
79
+
80
+AUTH *
81
+authnone_create (void)
82
+{
83
+  __libc_once (authnone_private_guard, authnone_create_once);
84
+  return &authnone_private.no_client;
85
 }
86
 libc_hidden_def(authnone_create)
87
 
88
 static bool_t
89
-authnone_marshal (AUTH *client attribute_unused, XDR *xdrs)
90
+authnone_marshal (AUTH *client, XDR *xdrs)
91
 {
92
   struct authnone_private_s *ap;
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.