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

Comparing ray/src/rt/rpict.c (file contents):
Revision 2.92 by greg, Thu Mar 21 16:52:40 2019 UTC vs.
Revision 2.93 by greg, Sat May 4 00:32:47 2019 UTC

# Line 288 | Line 288 | rpict(                 /* generate image(s) */
288                          break;
289                  pctdone = 0.0;
290                  if (pout != NULL) {
291 +                        int     myfd;
292                          close(1);                       /* reassign stdout */
293                          sprintf(fbuf, pout, seq);
294 +                tryagain:
295                          errno = 0;                      /* exclusive open */
296 <                        if (open(fbuf, O_WRONLY|O_CREAT|O_EXCL, 0666) != 1) {
296 >                        if ((myfd = open(fbuf, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) {
297                                  if ((errno != EEXIST) | (prvr != NULL) ||
298                                                  !strcmp(fbuf, pout)) {
299                                          sprintf(errmsg,
# Line 301 | Line 303 | rpict(                 /* generate image(s) */
303                                  }
304                                  setview(&ourview);
305                                  continue;               /* don't clobber */
306 +                        }
307 +                        if (myfd != 1) {
308 +                                unlink(fbuf);
309 +                                goto tryagain;          /* leave it open */
310                          }
311                          SET_FD_BINARY(1);
312                          dupheader();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines