X-Git-Url: https://git.gag.com/?p=debian%2Fas31;a=blobdiff_plain;f=as31%2Frun.c;fp=as31%2Frun.c;h=28c5317f9a56e49acb4912f00dddff1f1e598aa1;hp=126d3b5a014e6ca31406aad3480079a7f4f20305;hb=d5b765ed1bf83caaad8fbcfde9e6142f86d032b8;hpb=fde89d92ac2177c0a375fd3721b64c09c3aec9b5 diff --git a/as31/run.c b/as31/run.c index 126d3b5..28c5317 100644 --- a/as31/run.c +++ b/as31/run.c @@ -39,8 +39,8 @@ int run_as31(const char *infile, int lst, int use_stdout, char *incLineBuffer=NULL; int incSizeBuf=0; FILE* includeFile=NULL; + int fd; - uid_t uid; /* first, figure out all the file names */ dashl = lst; @@ -95,11 +95,18 @@ int run_as31(const char *infile, int lst, int use_stdout, } } - 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;