53 |
|
char command[SDnameLn+64]; |
54 |
|
int fd; |
55 |
|
/* write MGF to temp file */ |
56 |
< |
fd = open(mktemp(strcpy(tmpfile,TEMPLATE)), O_WRONLY|O_CREAT|O_EXCL); |
56 |
> |
fd = open(mktemp(strcpy(tmpfile,TEMPLATE)), O_WRONLY|O_CREAT|O_EXCL, 0600); |
57 |
|
if (fd < 0) { |
58 |
|
fprintf(stderr, "Cannot open temp file '%s'\n", tmpfile); |
59 |
|
return(0); |
60 |
|
} |
61 |
< |
write(fd, bsp->mgf, strlen(bsp->mgf)); |
61 |
> |
(void)write(fd, bsp->mgf, strlen(bsp->mgf)); |
62 |
|
close(fd); |
63 |
|
/* set up command */ |
64 |
|
if (do_instance) { |
100 |
|
return(0); |
101 |
|
} |
102 |
|
SDclearBSDF(&myBSDF, fname); |
103 |
< |
if (SDreportEnglish(SDloadFile(&myBSDF, pname), stderr)) |
103 |
> |
if (SDreportError(SDloadFile(&myBSDF, pname), stderr)) |
104 |
|
return(0); |
105 |
|
retOK = (myBSDF.dim[0] > FTINY) & (myBSDF.dim[1] > FTINY); |
106 |
|
if (!retOK) { |
113 |
|
retOK = (freopen(rname, "w", stdout) != NULL); |
114 |
|
} |
115 |
|
if (retOK) { |
116 |
+ |
if (myBSDF.matn[0] && myBSDF.makr[0]) |
117 |
+ |
printf("# Material '%s' by '%s'\n\n", |
118 |
+ |
myBSDF.matn, myBSDF.makr); |
119 |
|
if (myBSDF.mgf == NULL) { |
120 |
|
faceBSDF(&myBSDF, .0); |
121 |
|
} else { |