]> git.pld-linux.org Git - packages/pwdutils.git/blob - pwdutils-libc-lock.patch
make is optional in pam, make it optional here as well
[packages/pwdutils.git] / pwdutils-libc-lock.patch
1 diff -urN pwdutils-3.2.19/lib/read-files.c pwdutils-3.2.19.new/lib/read-files.c
2 --- pwdutils-3.2.19/lib/read-files.c    2006-11-29 14:18:52.000000000 +0100
3 +++ pwdutils-3.2.19.new/lib/read-files.c        2013-02-04 20:09:27.318544396 +0100
4 @@ -30,8 +30,7 @@
5  #include <errno.h>
6  #include <fcntl.h>
7  #include <nss.h>
8 -#include <bits/libc-lock.h>
9 -#define __libc_lock_t pthread_mutex_t
10 +#include <pthread.h>
11  
12  #include "read-files.h"
13  
14 @@ -174,11 +173,11 @@
15                   char *buffer, size_t buflen, int *errnop)
16  {
17    /* Locks the static variables in this file.  */
18 -  __libc_lock_define_initialized (static, lock)
19 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
20    enum nss_status status;
21    FILE *stream = NULL;
22  
23 -  __libc_lock_lock (lock);
24 +  pthread_mutex_lock (&lock);
25  
26    status = internal_setent (&stream, "/shadow");
27    if (status == NSS_STATUS_SUCCESS)
28 @@ -194,7 +193,7 @@
29        internal_endent (&stream);
30      }
31  
32 -  __libc_lock_unlock (lock);
33 +  pthread_mutex_unlock (&lock);
34  
35    return status;
36  }
37 @@ -204,11 +203,11 @@
38                   char *buffer, size_t buflen, int *errnop)
39  {
40    /* Locks the static variables in this file.  */
41 -  __libc_lock_define_initialized (static, lock)
42 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
43    enum nss_status status;
44    FILE *stream = NULL;
45  
46 -  __libc_lock_lock (lock);
47 +  pthread_mutex_lock (&lock);
48  
49    status = internal_setent (&stream, "/passwd");
50    if (status == NSS_STATUS_SUCCESS)
51 @@ -224,7 +223,7 @@
52        internal_endent (&stream);
53      }
54  
55 -  __libc_lock_unlock (lock);
56 +  pthread_mutex_unlock (&lock);
57  
58    return status;
59  }
60 @@ -234,11 +233,11 @@
61                   size_t buflen, int *errnop)
62  {
63    /* Locks the static variables in this file.  */
64 -  __libc_lock_define_initialized (static, lock)
65 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
66    enum nss_status status;
67    FILE *stream = NULL;
68  
69 -  __libc_lock_lock (lock);
70 +  pthread_mutex_lock (&lock);
71  
72    status = internal_setent (&stream, "/passwd");
73    if (status == NSS_STATUS_SUCCESS)
74 @@ -254,7 +253,7 @@
75        internal_endent (&stream);
76      }
77  
78 -  __libc_lock_unlock (lock);
79 +  pthread_mutex_unlock (&lock);
80  
81    return status;
82  }
83 @@ -265,14 +264,14 @@
84                   size_t buflen, int *errnop)
85  {
86    /* Some static variables */
87 -  __libc_lock_define_initialized (static, lock)
88 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
89    static FILE *stream;
90    static fpos_t position;
91  
92    /* Return next entry in host file.  */
93    enum nss_status status = NSS_STATUS_SUCCESS;
94  
95 -  __libc_lock_lock (lock);
96 +  pthread_mutex_lock (&lock);
97  
98    /* Be prepared that the set*ent function was not called before.  */
99    if (stream == NULL)
100 @@ -314,7 +313,7 @@
101          }
102      }
103  
104 -  __libc_lock_unlock (lock);
105 +  pthread_mutex_unlock (&lock);
106  
107    return status;
108  }
109 @@ -325,14 +324,14 @@
110                   size_t buflen, int *errnop)
111  {
112    /* Some static variables */
113 -  __libc_lock_define_initialized (static, lock)
114 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
115    static FILE *stream;
116    static fpos_t position;
117  
118    /* Return next entry in host file.  */
119    enum nss_status status = NSS_STATUS_SUCCESS;
120  
121 -  __libc_lock_lock (lock);
122 +  pthread_mutex_lock (&lock);
123  
124    /* Be prepared that the set*ent function was not called before.  */
125    if (stream == NULL)
126 @@ -374,7 +373,7 @@
127          }
128      }
129  
130 -  __libc_lock_unlock (lock);
131 +  pthread_mutex_unlock (&lock);
132  
133    return status;
134  }
135 diff -urN pwdutils-3.2.19/lib/read-files-group.c pwdutils-3.2.19.new/lib/read-files-group.c
136 --- pwdutils-3.2.19/lib/read-files-group.c      2006-11-29 14:18:54.000000000 +0100
137 +++ pwdutils-3.2.19.new/lib/read-files-group.c  2013-02-04 20:12:50.297444765 +0100
138 @@ -32,8 +32,7 @@
139  #include <errno.h>
140  #include <fcntl.h>
141  #include <nss.h>
142 -#include <bits/libc-lock.h>
143 -#define __libc_lock_t pthread_mutex_t
144 +#include <pthread.h>
145  
146  #include "read-files.h"
147  
148 @@ -138,11 +137,11 @@
149                   char *buffer, size_t buflen, int *errnop)
150  {
151    /* Locks the static variables in this file.  */
152 -  __libc_lock_define_initialized (static, lock)
153 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
154    enum nss_status status;
155    FILE *stream = NULL;
156  
157 -  __libc_lock_lock (lock);
158 +  pthread_mutex_lock (&lock);
159  
160    status = internal_setent (&stream, "/group");
161    if (status == NSS_STATUS_SUCCESS)
162 @@ -158,7 +157,7 @@
163        internal_endent (&stream);
164      }
165  
166 -  __libc_lock_unlock (lock);
167 +  pthread_mutex_unlock (&lock);
168  
169    return status;
170  }
171 @@ -168,11 +167,11 @@
172                   size_t buflen, int *errnop)
173  {
174    /* Locks the static variables in this file.  */
175 -  __libc_lock_define_initialized (static, lock)
176 +  static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
177    enum nss_status status;
178    FILE *stream = NULL;
179  
180 -  __libc_lock_lock (lock);
181 +  pthread_mutex_lock (&lock);
182  
183    status = internal_setent (&stream, "/group");
184    if (status == NSS_STATUS_SUCCESS)
185 @@ -188,12 +187,12 @@
186        internal_endent (&stream);
187      }
188  
189 -  __libc_lock_unlock (lock);
190 +  pthread_mutex_unlock (&lock);
191  
192    return status;
193  }
194  
195 -__libc_lock_define_initialized (static, lock);
196 +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
197  static FILE *stream;
198  static fpos_t position;
199  
200 @@ -205,7 +204,7 @@
201    /* Return next entry in host file.  */
202    enum nss_status status = NSS_STATUS_SUCCESS;
203  
204 -  __libc_lock_lock (lock);
205 +  pthread_mutex_lock (&lock);
206  
207    /* Be prepared that the set*ent function was not called before.  */
208    if (stream == NULL)
209 @@ -247,7 +246,7 @@
210          }
211      }
212  
213 -  __libc_lock_unlock (lock);
214 +  pthread_mutex_unlock (&lock);
215  
216    return status;
217  }
This page took 0.03607 seconds and 3 git commands to generate.