(lock_if_free): Don't loop; for strange error, return -1.

This commit is contained in:
Richard M. Stallman 1997-07-30 19:45:01 +00:00
parent 916848d8bd
commit c6c0c4b177

View file

@ -278,7 +278,7 @@ lock_if_free (clasher, lfname)
lock_info_type *clasher;
register char *lfname;
{
while (lock_file_1 (lfname, 0) == 0)
if (lock_file_1 (lfname, 0) == 0)
{
int locker;
@ -293,11 +293,8 @@ lock_if_free (clasher, lfname)
}
else if (locker == 1)
return 1; /* Someone else has it. */
else if (locker == -1)
return -1; /* Something's wrong. */
/* If some other error, or no such lock, try to lock again. */
/* Is there a case where we loop forever? */
return -1; /* Something's wrong. */
}
return 0;
}