- for (i = 0;;) {
- /* attempt to create lock file */
- if (lockit (&lkinfo) == 0) {
- /* if successful, turn on timer and return */
- timerON (lkinfo.curlock, fd);
- return fd;
- } else {
- /*
- * Abort locking, if we fail to lock after 5 attempts
- * and are never able to stat the lock file.
- */
- if (stat (lkinfo.curlock, &st) == -1) {
- if (i++ > 5)
- return -1;
- sleep (5);
+ {
+ int i;
+ for (i = 0;;) {
+ /* attempt to create lock file */
+ if (lockit (&lkinfo) == 0) {
+ /* if successful, turn on timer and return */
+ timerON (lkinfo.curlock, fd);
+ return fd;