martin-g commented on code in PR #3496:
URL: https://github.com/apache/avro/pull/3496#discussion_r2454277858


##########
lang/c++/test/StreamTests.cc:
##########
@@ -134,36 +135,34 @@ void testNonEmpty2(const TestData &td) {
     Verify1()(*is, td.dataSize);
 }
 
-static const char filename[] = "test_str.bin";
-
-struct FileRemover {
-    const std::filesystem::path file;
-    explicit FileRemover(const char *fn) : file(fn) {}
-    ~FileRemover() { std::filesystem::remove(file); }
+struct FileGuard {
+    const std::filesystem::path path{ std::tmpnam(nullptr) };

Review Comment:
   
https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/hs3e7355(v=vs.100)
   In the example code there is `// Note: tmpnam is deprecated; consider using 
tmpnam_s instead`
   
   Also in the build logs we can see:
   ```
   2025-10-23T08:00:00.3420284Z [ 68%] Linking CXX executable StreamTests
   2025-10-23T08:00:00.4955456Z /usr/bin/ld: 
CMakeFiles/StreamTests.dir/test/StreamTests.cc.o: in function 
`avro::stream::FileGuard::FileGuard()':
   2025-10-23T08:00:00.4957287Z 
/home/runner/work/avro/avro/lang/c++/test/StreamTests.cc:138:(.text._ZN4avro6stream9FileGuardC2Ev[_ZN4avro6stream9FileGuardC5Ev]+0x2a):
 warning: the use of `tmpnam' is dangerous, better use `mkstemp'
   2025-10-23T08:00:00.6147334Z [ 68%] Built target StreamTests
   ```
   
https://productionresultssa3.blob.core.windows.net/actions-results/abfc1b86-599c-48bd-a249-acda8f187020/workflow-job-run-670f0204-095a-5c23-a7d3-1d13fabc5e69/logs/job/job-logs.txt?rsct=text%2Fplain&se=2025-10-23T08%3A12%3A13Z&sig=9G%2FOy2gomdBnbYY%2FXTGGg%2Fza%2BjuKKXvqJVAL4xpemfg%3D&ske=2025-10-23T17%3A45%3A39Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2025-10-23T05%3A45%3A39Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2025-10-23T08%3A02%3A08Z&sv=2025-11-05



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to