of course, it'd be helpful to actually apply the patch in my tree... debian/2.3.1-5
authorBdale Garbee <bdale@gag.com>
Wed, 11 Jan 2012 18:23:32 +0000 (11:23 -0700)
committerBdale Garbee <bdale@gag.com>
Wed, 11 Jan 2012 18:23:32 +0000 (11:23 -0700)
as31/run.c

index 126d3b5a014e6ca31406aad3480079a7f4f20305..28c5317f9a56e49acb4912f00dddff1f1e598aa1 100644 (file)
@@ -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;