View | Details | Raw Unified | Return to bug 12355
Collapse All | Expand All

(-)dev86-0.16.17.orig/bcc/bcc.c (-8 / +16 lines)
Lines 122-132 Link Here
122
int dyn_count = 0;
122
int dyn_count = 0;
123
int error_count = 0;
123
int error_count = 0;
124
char * progname = "C";
124
char * progname = "C";
125
#ifdef MSDOS
126
char * tmpdir = "";
125
char * tmpdir = "";
127
#else
128
char * tmpdir = "/tmp/";
129
#endif
130
126
131
int main P((int argc, char **argv));
127
int main P((int argc, char **argv));
132
void getargs P((int argc, char **argv));
128
void getargs P((int argc, char **argv));
Lines 195-200 Link Here
195
   if ((temp = getenv("BCC_PREFIX")) != 0 )
191
   if ((temp = getenv("BCC_PREFIX")) != 0 )
196
      localprefix = copystr(temp);
192
      localprefix = copystr(temp);
197
193
194
#ifndef MSDOS
195
   /* XXX: this brings bcc behaviour in sync with the manual page which
196
           states that bcc uses TMPDIR for the temporary directory name.
197
           However, temporary file handling in this package is totally
198
           insecure and I see no easy way how to fix it. :(
199
                                                                -- (GM)
200
    */
201
   tmpdir = __secure_getenv("TMPDIR");
202
   if (!tmpdir || !*tmpdir)
203
      tmpdir = "/tmp";
204
#endif
205
198
   getargs(argc, argv);
206
   getargs(argc, argv);
199
   validate_link_opts();
207
   validate_link_opts();
200
208
Lines 727-735 Link Here
727
   {
735
   {
728
      char buf[16];
736
      char buf[16];
729
#ifdef MSDOS
737
#ifdef MSDOS
730
      sprintf(buf, "$$%05d$", dyn_count++);
738
      sprintf(buf, "/$$%05d$", dyn_count++);
731
#else
739
#else
732
      sprintf(buf, "$$%04d%05d", dyn_count++, getpid());
740
      sprintf(buf, "/$$%04d%05d", dyn_count++, getpid());
733
#endif
741
#endif
734
      file->file = catstr(tmpdir, buf);
742
      file->file = catstr(tmpdir, buf);
735
   }
743
   }
Lines 750-758 Link Here
750
      char buf[16];
758
      char buf[16];
751
      char * p;
759
      char * p;
752
#ifdef MSDOS
760
#ifdef MSDOS
753
      sprintf(buf, "$$%05d$", i);
761
      sprintf(buf, "/$$%05d$", i);
754
#else
762
#else
755
      sprintf(buf, "$$%04d%05d", i, getpid());
763
      sprintf(buf, "/$$%04d%05d", i, getpid());
756
#endif
764
#endif
757
      p = catstr(tmpdir, buf);
765
      p = catstr(tmpdir, buf);
758
      if (opt_v>1)
766
      if (opt_v>1)

Return to bug 12355