Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/35195 )

Change subject: arch-arm: Replace call to `tmpnam()` by `mkstemp()`
......................................................................

arch-arm: Replace call to `tmpnam()` by `mkstemp()`

According to the documentation, the use of tmpnam() should be
avoided.

Change-Id: Ibfe604d741b6b7d7b02fc051add217f95f81d05e
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
---
M src/arch/arm/semihosting.cc
1 file changed, 3 insertions(+), 2 deletions(-)



diff --git a/src/arch/arm/semihosting.cc b/src/arch/arm/semihosting.cc
index bd7b617..c7e8da3 100644
--- a/src/arch/arm/semihosting.cc
+++ b/src/arch/arm/semihosting.cc
@@ -450,9 +450,10 @@
                            size_t size)
 {
     std::vector<char> buf(L_tmpnam);
-    char *path = tmpnam(buf.data());
-    if (!path)
+    int64_t fd = mkstemp(buf.data());
+    if (fd < 0)
         return retError(EINVAL);
+    char* path = buf.data();

     const size_t path_len = strlen(path);
     if (path_len >= size)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35195
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ibfe604d741b6b7d7b02fc051add217f95f81d05e
Gerrit-Change-Number: 35195
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to