665 |
|
fputc('\n', ambfp); |
666 |
|
putambmagic(ambfp); |
667 |
|
} else if (getheader(ambfp, amb_headline, NULL) < 0 || !hasambmagic(ambfp)) { |
668 |
< |
#ifndef F_SETLKW |
669 |
< |
static int ntries = 3; |
670 |
< |
if (--ntries > 0 && ftell(ambfp) == 0) { |
668 |
> |
int ntries = 2; |
669 |
> |
if (ntries-- > 0 && ftell(ambfp) == 0) { |
670 |
> |
#ifdef F_SETLKW |
671 |
> |
aflock(F_UNLCK); |
672 |
|
clearerr(ambfp); |
673 |
|
sleep(2); |
674 |
+ |
aflock(F_RDLCK); |
675 |
+ |
#else |
676 |
+ |
clearerr(ambfp); |
677 |
+ |
sleep(2); |
678 |
+ |
#endif |
679 |
|
goto retry; |
680 |
|
} |
675 |
– |
#endif |
681 |
|
error(USER, "bad/incompatible ambient file"); |
682 |
|
} |
683 |
|
if ((AMB_CNDX != CNDX) | (AMB_WLPART != WLPART)) { |