1128
1128
/* try destination directory */
1129
1129
path (to,dpart,fpart);
1130
1130
(void) sprintf (tname,"%s/#%d.sup",dpart,thispid);
1131
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1131
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1132
1132
if (tof >= 0) break;
1133
1133
/* try sup directory */
1134
1134
if (thisC->Cprefix) (void) chdir (thisC->Cbase);
1135
1135
(void) sprintf (tname,"sup/#%d.sup",thispid);
1136
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1136
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1137
1137
if (tof >= 0) {
1138
1138
if (thisC->Cprefix) (void) chdir (thisC->Cprefix);
1141
1141
/* try base directory */
1142
1142
(void) sprintf (tname,"#%d.sup",thispid);
1143
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1143
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1144
1144
if (thisC->Cprefix) (void) chdir (thisC->Cprefix);
1145
1145
if (tof >= 0) break;
1147
1147
/* try /var/tmp */
1148
1148
(void) sprintf (tname,"/var/tmp/#%d.sup",thispid);
1149
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1149
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1150
1150
if (tof >= 0) break;
1152
1152
/* try /usr/tmp */
1153
1153
(void) sprintf (tname,"/usr/tmp/#%d.sup",thispid);
1154
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1154
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1155
1155
if (tof >= 0) break;
1158
1158
(void) sprintf (tname,"/tmp/#%d.sup",thispid);
1159
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1159
tof = open (tname,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1160
1160
if (tof >= 0) break;
1161
1161
istemp = FALSE;
1162
1162
/* give up: try to create output file */
1163
1163
if (!docompress)
1164
tof = open (to,(O_WRONLY|O_CREAT|O_TRUNC),0600);
1164
tof = open (to,(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL),0600);
1165
1165
if (tof >= 0) break;
1167
1167
notify ("SUP: Can't create %s or temp file for it\n",to);