#include <lockfile.h>
#endif
-#ifdef LOCKDIR
+#ifdef DOT_LOCKING
+# ifdef LOCKDIR
char *lockdir = LOCKDIR;
+# endif
#endif
/* Are we using any kernel locking? */
j = errno;
close(fd);
- sleep(5);
+ sleep(1);
}
close(fd);
if (stat(lkinfo.curlock, &st) == -1) {
if (i++ > 5)
return -1;
- sleep(5);
+ sleep(1);
} else {
time_t curtime;
i = 0;
if (curtime > st.st_ctime + RSECS)
unlink(lkinfo.curlock);
else
- sleep(5);
+ sleep(1);
}
lockname(file, &lkinfo, 1);
}
struct lock *lp;
size_t len;
- lp = (struct lock *) mh_xmalloc(sizeof(*lp));
+ lp = mh_xcalloc(1, sizeof(*lp));
len = strlen(curlock) + 1;
lp->l_fd = fd;
- lp->l_lock = mh_xmalloc(len);
+ lp->l_lock = mh_xcalloc(len, sizeof(char));
memcpy(lp->l_lock, curlock, len);
lp->l_next = l_top;
else
pp->l_next = lp->l_next;
- free(lp->l_lock);
- free(lp);
+ mh_free0(&(lp->l_lock));
+ mh_free0(&lp);
}
}