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.63 by greg, Thu Sep 13 20:13:16 2007 UTC vs.
Revision 2.64 by greg, Fri Sep 14 00:50:31 2007 UTC

# Line 902 | Line 902 | ambsync(void)                  /* synchronize ambient file */
902                          avinsert(avstore(&avs));
903                          n -= AMBVALSIZ;
904                  }
905 +                lastpos = flen - n;
906                  /*** seek always as safety measure
907                  if (n) ***/                     /* alignment */
908 <                        if (lseek(fileno(ambfp), (off_t)(flen-n), SEEK_SET) < 0)
908 >                        if (lseek(fileno(ambfp), (off_t)lastpos, SEEK_SET) < 0)
909                                  goto seekerr;
910          }
911   #ifdef  DEBUG
# Line 917 | Line 918 | ambsync(void)                  /* synchronize ambient file */
918   #endif
919   syncend:
920          n = fflush(ambfp);                      /* calls write() at last */
921 <        if ((lastpos = lseek(fileno(ambfp), (off_t)0, SEEK_CUR)) < 0)
922 <                goto seekerr;
921 >        if (n == EOF) {
922 >                if ((lastpos = lseek(fileno(ambfp), (off_t)0, SEEK_CUR)) < 0)
923 >                        goto seekerr;
924 >        } else
925 >                lastpos += (long)nunflshed*AMBVALSIZ;
926          aflock(F_UNLCK);                        /* release file */
927          nunflshed = 0;
928          return(n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines