char *incLineBuffer=NULL;
int incSizeBuf=0;
FILE* includeFile=NULL;
+ int fd;
- uid_t uid;
/* first, figure out all the file names */
dashl = lst;
}
}
- uid = geteuid();
- sprintf(tmpName,"/tmp/as31-%i-%ld.asm",uid,random());
- fin = fopen(tmpName, "w");
+ sprintf(tmpName,"/tmp/as31-XXXXXX.asm");
+ fd = mkstemps(tmpName, 4);
+ if (fd == -1) {
+ mesg_f("Cannot create temp file\n");
+ if (outfile) free(outfile);
+ if (lstfile) free(lstfile);
+ return -1;
+ }
+ fin = fdopen(fd, "w");
if (fin == NULL) {
mesg_f("Cannot open temp file: %s\n",tmpName);
+ close(fd);
if (outfile) free(outfile);
if (lstfile) free(lstfile);
return -1;