Skip to content

Commit

Permalink
Silence tmpname warning (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
torben-hansen authored Aug 21, 2024
1 parent 3c69611 commit 3f9916c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crypto/test/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ FILE* createRawTempFILE() {
}
#else
#include <cstdlib>
#include <unistd.h>
size_t createTempFILEpath(char buffer[PATH_MAX]) {
OPENSSL_BEGIN_ALLOW_DEPRECATED
OPENSSL_STATIC_ASSERT(PATH_MAX >= L_tmpnam, PATH_MAX_too_short);
// Functions for constructing a tempfile path (i.e., tmpname and mktemp)
// are deprecated in C99.
if(nullptr == tmpnam(buffer)) {
snprintf(buffer, PATH_MAX, "awslcTestTmpFileXXXXXX");

int fd = mkstemp(buffer);
if (fd == -1) {
return 0;
}
OPENSSL_END_ALLOW_DEPRECATED

close(fd);
return strnlen(buffer, PATH_MAX);
}
FILE* createRawTempFILE() {
Expand Down

0 comments on commit 3f9916c

Please sign in to comment.