ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/ambient.c
(Generate patch)

Comparing ray/src/rt/ambient.c (file contents):
Revision 2.120 by greg, Wed Nov 22 16:21:48 2023 UTC vs.
Revision 2.121 by greg, Mon Jan 29 19:24:00 2024 UTC

# Line 634 | Line 634 | initambfile(           /* initialize ambient file */
634          if (mybuf == NULL)
635                  mybuf = (char *)bmalloc(BUFSIZ+8);
636          setbuf(ambfp, mybuf);
637 + retry:
638          if (cre8) {                     /* new file */
639                  newheader("RADIANCE", ambfp);
640                  fprintf(ambfp, "%s -av %g %g %g -aw %d -ab %d -aa %g ",
# Line 659 | Line 660 | initambfile(           /* initialize ambient file */
660                  fputformat(AMBFMT, ambfp);
661                  fputc('\n', ambfp);
662                  putambmagic(ambfp);
663 <        } else if (getheader(ambfp, amb_headline, NULL) < 0 || !hasambmagic(ambfp))
663 >        } else if (getheader(ambfp, amb_headline, NULL) < 0 || !hasambmagic(ambfp)) {
664 > #ifndef  F_SETLKW
665 >                static int      ntries = 0;
666 >                if (++ntries < 4 && ftell(ambfp) == 0) {
667 >                        sleep(2);
668 >                        goto retry;
669 >                }
670 > #endif
671                  error(USER, "bad/incompatible ambient file");
672 <
672 >        }
673          if ((AMB_CNDX != CNDX) | (AMB_WLPART != WLPART)) {
674                  if (setspectrsamp(AMB_CNDX, AMB_WLPART) < 0)
675                          error(USER, "bad wavelength sampling in ambient file");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines