fixes problems found by github autobuild

This commit is contained in:
Gorilla Sapiens
2025-05-27 06:18:24 +00:00
parent 11d3338282
commit 9a2f754e8d
3 changed files with 15 additions and 5 deletions

View File

@@ -673,7 +673,7 @@ static void Compile (const char* File)
if (DoAssemble) {
/* set a temporary output file name */
TmpFile = MakeTmpFilename(File, ".s");
TmpFile = MakeTmpFilename(".s");
CmdSetOutput (&CC65, TmpFile);
}

View File

@@ -119,16 +119,26 @@ char* MakeFilename (const char* Origin, const char* Ext)
char* MakeTmpFilename (const char* Origin, const char* Ext)
char* MakeTmpFilename (const char* Ext)
/* Make a new temporary file name from Ext. tmpnam(3) is called
** and Ext is appended to generate the filename. Origin is ignored.
** and Ext is appended to generate the filename.
** The result is placed in a malloc'ed buffer and returned.
*/
{
char* Out;
char Buffer[L_tmpnam * 2]; /* a lazy way to ensure we have space for Ext */
tmpnam(Buffer);
/*
** gcc emits the following warning here:
**
** warning: the use of `tmpnam' is dangerous, better use `mkstemp'
**
** however, mkstemp actually opens a file, which we do not want.
** we could write our own version, but then we would have to struggle
** with supporting multiple build environments. tmpnam(3) is fine
** here.
*/
(void) tmpnam(Buffer);
strcat(Buffer, Ext);
Out = xmalloc (strlen (Buffer) + 1);

View File

@@ -59,7 +59,7 @@ char* MakeFilename (const char* Origin, const char* Ext);
** The function may be used to create "foo.o" from "foo.s".
*/
char* MakeTmpFilename (const char* Origin, const char* Ext);
char* MakeTmpFilename (const char* Ext);
/* Make a new temporary file name from Ext. tmpnam(3) is called
** and Ext is appended to generate the filename. Origin is ignored.
** The result is placed in a malloc'ed buffer and returned.