Skip to content

Commit

Permalink
Fix tmpnam warning
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Mar 14, 2024
1 parent f4ee72e commit 78e7e0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion image/encode/strenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,10 @@ Int StrIOEncInit(CWMImageStrCodec* pSC)
pSC->ppTempFile[i] = (char *)malloc(FILENAME_MAX * sizeof(char));
if(pSC->ppTempFile[i] == NULL) return ICERR_ERROR;

if ((pFilename = tmpnam(NULL)) == NULL)
char tmpnambuf[] = {'f', 'i', 'l', 'e', 'X', 'X', 'X', 'X', 'X', 'X', '\0'};
if (mkstemp(tmpnambuf) == -1)
return ICERR_ERROR;
pFilename = tmpnambuf;
strcpy(pSC->ppTempFile[i], pFilename);
#endif
if(CreateWS_File(pSC->ppWStream + i, pFilename, "w+b") != ICERR_OK) return ICERR_ERROR;
Expand Down

0 comments on commit 78e7e0f

Please # to comment.