aboutsummaryrefslogtreecommitdiff
path: root/src/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lock.c')
-rw-r--r--src/lock.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lock.c b/src/lock.c
index 32367de..dece75d 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -184,21 +184,21 @@ host_name ()
184 184
185 do 185 do
186 { 186 {
187 if (!hostbuf) 187 if (!hostbuf)
188 { 188 {
189 size = 256; 189 size = 256;
190 hostbuf = xmalloc (size); 190 hostbuf = grecs_malloc (size);
191 } 191 }
192 else 192 else
193 { 193 {
194 size_t ns = size * 2; 194 size_t ns = size * 2;
195 if (size < ns) 195 if (size < ns)
196 xalloc_die (); 196 grecs_alloc_die ();
197 size = ns; 197 size = ns;
198 hostbuf = xrealloc (hostbuf, size); 198 hostbuf = grecs_realloc (hostbuf, size);
199 } 199 }
200 } 200 }
201 while ((rc = gethostname (hostbuf, size )) == -1 && 201 while ((rc = gethostname (hostbuf, size )) == -1 &&
202 (errno == EINVAL 202 (errno == EINVAL
203#ifdef ENAMETOOLONG 203#ifdef ENAMETOOLONG
204 || errno == ENAMETOOLONG 204 || errno == ENAMETOOLONG
@@ -258,13 +258,13 @@ wydawca_unlock (const char *lockfile)
258 unlink (lockfile); 258 unlink (lockfile);
259} 259}
260 260
261static char * 261static char *
262fix_tagname (const char *tag) 262fix_tagname (const char *tag)
263{ 263{
264 char *tagname = xstrdup (tag); 264 char *tagname = grecs_strdup (tag);
265 char *p; 265 char *p;
266 266
267 for (p = tagname; *p; p++) 267 for (p = tagname; *p; p++)
268 if (!isalnum (*p) && *p != '_' && *p != '-') 268 if (!isalnum (*p) && *p != '_' && *p != '-')
269 *p = '_'; 269 *p = '_';
270 return tagname; 270 return tagname;
@@ -275,22 +275,22 @@ wydawca_lockname (const char *tag)
275{ 275{
276 char *lockname = NULL; 276 char *lockname = NULL;
277 size_t size = 0; 277 size_t size = 0;
278 char *tagname = fix_tagname (tag); 278 char *tagname = fix_tagname (tag);
279 grecs_asprintf (&lockname, &size, "%s/LCK.%s", lockdir, tagname); 279 grecs_asprintf (&lockname, &size, "%s/LCK.%s", lockdir, tagname);
280 if (!lockname) 280 if (!lockname)
281 xalloc_die (); 281 grecs_alloc_die ();
282 free (tagname); 282 free (tagname);
283 return lockname; 283 return lockname;
284} 284}
285 285
286void 286void
287wydawca_lock_init () 287wydawca_lock_init ()
288{ 288{
289 if (enable_locking) 289 if (enable_locking)
290 { 290 {
291 if (!lockdir) 291 if (!lockdir)
292 lockdir = xstrdup (LOCALSTATEDIR "/lock/" PACKAGE); 292 lockdir = grecs_strdup (LOCALSTATEDIR "/lock/" PACKAGE);
293 if (create_hierarchy (lockdir, 0)) 293 if (create_hierarchy (lockdir, 0))
294 exit (EX_OSFILE); 294 exit (EX_OSFILE);
295 } 295 }
296} 296}

Return to:

Send suggestions and report system problems to the System administrator.