nixpkgs/pkgs/development/libraries/science/math/atlas/tmpdir.patch

276 lines
7.7 KiB
Diff

diff --git a/CONFIG/ARCHS/negflt.c b/CONFIG/ARCHS/negflt.c
index e5b7871..d45e387 100644
--- a/CONFIG/ARCHS/negflt.c
+++ b/CONFIG/ARCHS/negflt.c
@@ -239,7 +239,7 @@ void NegFile(char *fnam, int N, int *cols)
FILE *fpin, *fpout;
WORDS *wp0, *wp;
- tnam = tmpnam(NULL);
+ tnam = tempnam(NULL, NULL);
fpin = fopen(fnam, "r");
assert(fpin);
fpout = fopen(tnam, "w");
diff --git a/CONFIG/include/atlas_sys.h b/CONFIG/include/atlas_sys.h
index b83a749..8902d38 100644
--- a/CONFIG/include/atlas_sys.h
+++ b/CONFIG/include/atlas_sys.h
@@ -216,12 +216,13 @@ static char *ATL_fgets_CWS(char *sout, int *plen, FILE *fpin)
static char *ATL_tmpnam(void)
{
- static char tnam[L_tmpnam];
+ static char *tnam;
static char FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(tnam));
+ tnam = tempnam(NULL, NULL);
+ assert(tnam);
}
return(tnam);
}
diff --git a/bin/atlas_install.c b/bin/atlas_install.c
index 2753cbf..e49cc3e 100644
--- a/bin/atlas_install.c
+++ b/bin/atlas_install.c
@@ -662,7 +662,8 @@ void GoToTown(int ARCHDEF, int L1DEF, int TuneLA)
{
const char TR[2] = {'N','T'};
char prec[4] = {'d', 's', 'z', 'c'}, pre, upre, *typ;
- char ln[1024], tnam[256], ln2[512], ln3[512], fnam[128];
+ char ln[1024], ln2[512], ln3[512], fnam[128];
+ char *tnam;
char *mulinst, *peakstr, *peakstr2;
int nprec=4;
int iL1, lat, muladd, maused, latuse, lbnreg;
@@ -681,7 +682,7 @@ void GoToTown(int ARCHDEF, int L1DEF, int TuneLA)
fpsum = fopen("INSTALL_LOG/SUMMARY.LOG", "a");
ATL_Cassert(fpsum, "OPENING INSTALL_LOG/SUMMARY.LOG", NULL);
- ATL_Cassert(tmpnam(tnam), "GETTING TEMPFILE", NULL);
+ ATL_Cassert((tnam = tempnam(NULL, NULL)), "GETTING TEMPFILE", NULL);
if (L1DEF)
{
diff --git a/bin/extract.c b/bin/extract.c
index 7a5a926..53fb8bf 100644
--- a/bin/extract.c
+++ b/bin/extract.c
@@ -3378,7 +3378,7 @@ void PushProc0(EXTENV *EE, EXTPROC **basep, EXTPROC **myfuncs, char *ln)
pp->argnams = KillWord(wp, wp);
pp->nargs = CountWords(pp->argnams);
- cp = tmpnam(NULL);
+ cp = tempnam(NULL, NULL);
if (cp == NULL) ExtErr(EE, "Out of tmpnams!!!");
i = Wstrlen(cp) + 1;
pp->FileNam = malloc(i*sizeof(char));
diff --git a/include/atlas_mvtesttime.h b/include/atlas_mvtesttime.h
index 9147fcb..ab6a99f 100644
--- a/include/atlas_mvtesttime.h
+++ b/include/atlas_mvtesttime.h
@@ -105,14 +105,15 @@ static int MVKernelFailsTest
char ln[4096];
char *sp;
int i, lda0;
- static char outnam[L_tmpnam];
+ static char* outnam;
static int FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(outnam));
+ outnam = tempnam(NULL, NULL);
+ assert(outnam);
}
/*
* If the file is generated, call generator to create it
@@ -221,14 +222,15 @@ static double TimeMVKernel
char ln[2048], resf[256], *sp;
double *dp, mf;
int i, align = pre2size(pre);
- static char outnam[L_tmpnam];
+ static char* outnam;
static int FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(outnam));
+ outnam = tempnam(NULL, NULL);
+ assert(outnam);
}
/*
* If the file is generated, call generator to create it
diff --git a/include/atlas_r1testtime.h b/include/atlas_r1testtime.h
index b33213a..f27ee25 100644
--- a/include/atlas_r1testtime.h
+++ b/include/atlas_r1testtime.h
@@ -76,14 +76,15 @@ static int R1KernelFailsTest
char ln[4096];
char *sp;
int i, lda0;
- static char outnam[L_tmpnam];
+ static char* outnam;
static int FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(outnam));
+ outnam = tempnam(NULL, NULL);
+ assert(outnam);
}
/*
* If the file is generated, call generator to create it
@@ -187,14 +188,15 @@ static double TimeR1Kernel
char ln[2048], resf[256], *sp;
double *dp, mf;
int i, align = pre2size(pre);
- static char outnam[L_tmpnam];
+ static char* outnam;
static int FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(outnam));
+ outnam = tempnam(NULL, NULL);
+ assert(outnam);
}
/*
* If the file is generated, call generator to create it
diff --git a/include/atlas_r2testtime.h b/include/atlas_r2testtime.h
index facc66d..c638dce 100644
--- a/include/atlas_r2testtime.h
+++ b/include/atlas_r2testtime.h
@@ -76,14 +76,15 @@ static int R2KernelFailsTest
char ln[4096];
char *sp;
int i, lda0;
- static char outnam[L_tmpnam];
+ static char* outnam;
static int FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(outnam));
+ outnam = tempnam(NULL, NULL);
+ assert(outnam);
}
/*
* If the file is generated, call generator to create it
@@ -187,14 +188,15 @@ static double TimeR2Kernel
char ln[2048], resf[256], *sp;
double *dp, mf;
int i, align = pre2size(pre);
- static char outnam[L_tmpnam];
+ static char* outnam;
static int FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(outnam));
+ outnam = tempnam(NULL, NULL);
+ assert(outnam);
}
/*
* If the file is generated, call generator to create it
diff --git a/include/atlas_sys.h b/include/atlas_sys.h
index b83a749..b3f88d2 100644
--- a/include/atlas_sys.h
+++ b/include/atlas_sys.h
@@ -216,12 +216,13 @@ static char *ATL_fgets_CWS(char *sout, int *plen, FILE *fpin)
static char *ATL_tmpnam(void)
{
- static char tnam[L_tmpnam];
+ static char* tnam;
static char FirstTime=1;
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(tnam));
+ tnam = tempnam(NULL, NULL);
+ assert(tnam);
}
return(tnam);
}
diff --git a/tune/blas/gemm/usercomb.c b/tune/blas/gemm/usercomb.c
index 59a7cd4..eb3eb05 100644
--- a/tune/blas/gemm/usercomb.c
+++ b/tune/blas/gemm/usercomb.c
@@ -138,11 +138,13 @@ int GetUserCase(char pre, int icase, int *iflag, int *mb, int *nb, int *kb,
void CombineFiles(char *fout, int nfiles, char **fnams)
{
- char tnam[256], ln[512];
+ char ln[512];
+ char *tnam;
int i, j, n, nn;
FILE *fpout, *fpin;
- assert(tmpnam(tnam));
+ tnam = tempnam(NULL, NULL);
+ assert(tnam);
for (n=i=0; i < nfiles; i++) n += NumUserCases0(fnams[i]);
fpout = fopen(tnam, "w");
diff --git a/tune/blas/gemm/userflag.c b/tune/blas/gemm/userflag.c
index c3983e4..b7dd70b 100644
--- a/tune/blas/gemm/userflag.c
+++ b/tune/blas/gemm/userflag.c
@@ -139,8 +139,8 @@ int GetUserCase(char pre, int icase, int *iflag, int *mb, int *nb, int *kb,
void GoGetThem(char *infile, char *outfile)
{
- char ln[512], ln2[512], tnam[256], MCC[256], MMFLAGS[256];
- char *chkfile = "FlagCheck.c", *sp, *sp2;
+ char ln[512], ln2[512], MCC[256], MMFLAGS[256];
+ char *chkfile = "FlagCheck.c", *sp, *sp2, *tnam;
FILE *fpin, *fpout;
int i, j, n, nmin=0, good;
int wass;
@@ -152,7 +152,8 @@ void GoGetThem(char *infile, char *outfile)
n = NumUserCases0(infile);
fpin = fopen(infile, "r");
assert(fpin);
- assert(tmpnam(tnam));
+ tnam = tempnam(NULL, NULL);
+ assert(tnam);
fpout = fopen(tnam, "w");
assert(fpout);
assert(fgets(ln, 512, fpin));
diff --git a/tune/sysinfo/emit_buildinfo.c b/tune/sysinfo/emit_buildinfo.c
index 309c06a..3feaea7 100644
--- a/tune/sysinfo/emit_buildinfo.c
+++ b/tune/sysinfo/emit_buildinfo.c
@@ -41,14 +41,15 @@ static char SMCVERS[LNLEN], DMCVERS[LNLEN], SKCVERS[LNLEN], DKCVERS[LNLEN];
static char UNAM[64], DATE[128];
char *CmndResults(char *cmnd)
{
- static char tnam[128];
+ static char* tnam;
static int FirstTime=1;
char ln[512];
if (FirstTime)
{
FirstTime = 0;
- assert(tmpnam(tnam));
+ tnam = tempnam(NULL, NULL);
+ assert(tnam);
}
sprintf(ln, "%s > %s\n", cmnd, tnam);
fprintf(stderr, "system: %s", ln);